From e56eec70ca5beb08ca9d34adae6a02bb4a1ef90f Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Fri, 30 Aug 2019 07:39:02 -0400 Subject: [PATCH] Call to_address in the scalar destroy case too --- include/boost/smart_ptr/allocate_unique.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/boost/smart_ptr/allocate_unique.hpp b/include/boost/smart_ptr/allocate_unique.hpp index c413715..5dccf0a 100644 --- a/include/boost/smart_ptr/allocate_unique.hpp +++ b/include/boost/smart_ptr/allocate_unique.hpp @@ -294,8 +294,7 @@ inline void sp_alloc_clear(A& a, typename sp_alloc_type::type p, std::size_t, boost::false_type) { - boost::alloc_destroy(a, p); - a.deallocate(p, 1); + boost::alloc_destroy(a, boost::to_address(p)); } template @@ -310,7 +309,6 @@ sp_alloc_clear(A& a, typename sp_alloc_type::type p, std::size_t n, #endif boost::alloc_destroy_n(a, boost::first_scalar(boost::to_address(p)), n * sp_alloc_size::value); - a.deallocate(p, n); } } /* detail */ @@ -332,6 +330,7 @@ public: void operator()(pointer p) { detail::sp_alloc_clear(base::get(), p.ptr(), p.size(), is_array()); + base::get().deallocate(p.ptr(), p.size()); } };