From adc0cdddff785ab85e61eabcad63f0d32f3f990a Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Fri, 14 Feb 2014 18:31:52 -0800 Subject: [PATCH] Make as_allocator::deallocate consistent --- include/boost/smart_ptr/detail/array_allocator.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/smart_ptr/detail/array_allocator.hpp b/include/boost/smart_ptr/detail/array_allocator.hpp index a5a2d61..2a60528 100644 --- a/include/boost/smart_ptr/detail/array_allocator.hpp +++ b/include/boost/smart_ptr/detail/array_allocator.hpp @@ -160,12 +160,13 @@ namespace boost { M = boost::alignment_of::value }; std::size_t n1 = count * sizeof(value_type) + M - 1; + std::size_t n2 = size * sizeof(type); char* p1 = reinterpret_cast(memory); CA ca(*this); #if !defined(BOOST_NO_CXX11_ALLOCATOR) - CT::deallocate(ca, p1, size + n1); + CT::deallocate(ca, p1, n1 + n2); #else - ca.deallocate(p1, size + n1); + ca.deallocate(p1, n1 + n2); #endif }