[libcxx-commits] [libcxx] [libc++] Use correct size for deallocation of arrays in shared_ptr (PR #68233)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 4 14:03:53 PDT 2023


================
@@ -1220,7 +1221,7 @@ struct __bounded_array_control_block<_Tp[_Count], _Alloc>
 
         _ControlBlockAlloc __tmp(__alloc_);
         __alloc_.~_Alloc();
-        allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), sizeof(*this));
+        allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), 1);
----------------
EricWF wrote:

Oof, that's a nasty bug. Thanks for the fix.

https://github.com/llvm/llvm-project/pull/68233


More information about the libcxx-commits mailing list