Fix deallocate in multi_buffer

This commit is contained in:
Vinnie Falco
2019-07-03 17:21:00 -07:00
parent ff2c0ca91e
commit 89c922e02b
2 changed files with 10 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
Version 262:
* Fix deallocate in multi_buffer
--------------------------------------------------------------------------------
Version 261:
* Deduplicate `websocket::read_size_hint` definition

View File

@@ -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<align_type*>(&e), len);
destroy(e);
#if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK
debug_check();
#endif
@@ -1183,7 +1180,8 @@ destroy(element& e)
{
auto a = rebind_type{this->get()};
auto const n =
(sizeof(element) + e.size() + sizeof(align_type) - 1) /
(sizeof(element) + e.size() +
sizeof(align_type) - 1) /
sizeof(align_type);
e.~element();
alloc_traits::deallocate(a,