diff --git a/CHANGELOG.md b/CHANGELOG.md index 90badd68..a067c0bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 262: + +* Fix deallocate in multi_buffer + +-------------------------------------------------------------------------------- + Version 261: * Deduplicate `websocket::read_size_hint` definition diff --git a/include/boost/beast/core/impl/multi_buffer.hpp b/include/boost/beast/core/impl/multi_buffer.hpp index f4dfd1c7..e31a8a36 100644 --- a/include/boost/beast/core/impl/multi_buffer.hpp +++ b/include/boost/beast/core/impl/multi_buffer.hpp @@ -977,10 +977,7 @@ consume(size_type n) noexcept in_pos_ = 0; auto& e = list_.front(); list_.erase(list_.iterator_to(e)); - auto const len = sizeof(e) + e.size(); - e.~element(); - alloc_traits::deallocate(a, - reinterpret_cast(&e), len); + destroy(e); #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif @@ -1183,8 +1180,9 @@ destroy(element& e) { auto a = rebind_type{this->get()}; auto const n = - (sizeof(element) + e.size() + sizeof(align_type) - 1) / - sizeof(align_type); + (sizeof(element) + e.size() + + sizeof(align_type) - 1) / + sizeof(align_type); e.~element(); alloc_traits::deallocate(a, reinterpret_cast(&e), n);