From d5cd3e829b702876f4bd085a34b8f9b90dc069b9 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 30 Jun 2019 19:00:18 -0700 Subject: [PATCH] Don't over-allocate in http::basic_fields --- CHANGELOG.md | 1 + include/boost/beast/http/fields.hpp | 2 +- include/boost/beast/http/impl/fields.hpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26ac09ac..0b5a9506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 -------------------------------------------------------------------------------- diff --git a/include/boost/beast/http/fields.hpp b/include/boost/beast/http/fields.hpp index f891acb1..24b1a122 100644 --- a/include/boost/beast/http/fields.hpp +++ b/include/boost/beast/http/fields.hpp @@ -196,7 +196,7 @@ private: using rebind_type = typename beast::detail::allocator_traits:: - template rebind_alloc; + template rebind_alloc; using alloc_traits = beast::detail::allocator_traits; diff --git a/include/boost/beast/http/impl/fields.hpp b/include/boost/beast/http/impl/fields.hpp index 0fa3bedd..0788e59e 100644 --- a/include/boost/beast/http/impl/fields.hpp +++ b/include/boost/beast/http/impl/fields.hpp @@ -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(&e), n); + alloc_traits::deallocate(a, + reinterpret_cast(&e), n); } template