diff options
author | Chris Robinson <[email protected]> | 2020-08-15 23:53:43 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-08-15 23:53:43 -0700 |
commit | 34b29a48a44ebd62cb1c1745e915ee7a8de54b69 (patch) | |
tree | 2557508ec0a5227b97192c06297978ea2931352a /common/almalloc.h | |
parent | 23259b48dd36ea91f3a2bddd32122b35b1469e4c (diff) |
Ensure enough space is allocated for structs with a FlexArray
Diffstat (limited to 'common/almalloc.h')
-rw-r--r-- | common/almalloc.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/almalloc.h b/common/almalloc.h index a2fdd9d8..0949efdc 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -47,7 +47,10 @@ enum FamCount : size_t { }; #define DEF_FAM_NEWDEL(T, FamMem) \ static constexpr size_t Sizeof(size_t count) noexcept \ - { return decltype(FamMem)::Sizeof(count, offsetof(T, FamMem)); } \ + { \ + return std::max<size_t>(sizeof(T), \ + decltype(FamMem)::Sizeof(count, offsetof(T, FamMem))); \ + } \ \ void *operator new(size_t /*size*/, FamCount count) \ { \ |