Don't over-allocate in http::basic_fields

This commit is contained in:
Vinnie Falco
2019-06-30 19:00:18 -07:00
parent 5f0939e771
commit d5cd3e829b
3 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@ Version 261:
* Fix UB in websocket read tests
* Remove redundant includes in websocket
* Simplify websocket::detail::prng
* Don't over-allocate in http::basic_fields
--------------------------------------------------------------------------------

View File

@ -196,7 +196,7 @@ private:
using rebind_type = typename
beast::detail::allocator_traits<Allocator>::
template rebind_alloc<element>;
template rebind_alloc<align_type>;
using alloc_traits =
beast::detail::allocator_traits<rebind_type>;

View File

@ -990,8 +990,8 @@ delete_element(element& e)
(sizeof(element) + e.off_ + e.len_ + 2 + sizeof(align_type) - 1) /
sizeof(align_type);
e.~element();
alloc_traits::deallocate(a, &e, n);
//reinterpret_cast<align_type*>(&e), n);
alloc_traits::deallocate(a,
reinterpret_cast<align_type*>(&e), n);
}
template<class Allocator>