From 3dc4f33ad561ec494f693954fc3d381e1828d495 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 17 Dec 2017 12:16:08 +0000 Subject: [PATCH] Don't call deallocate with null pointers --- include/boost/functional/factory.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/boost/functional/factory.hpp b/include/boost/functional/factory.hpp index 70a6f9c..8f59963 100644 --- a/include/boost/functional/factory.hpp +++ b/include/boost/functional/factory.hpp @@ -116,13 +116,15 @@ namespace boost void operator()(value_type* ptr) const { - if (!! ptr) ptr->~value_type(); + if (!! ptr) { + ptr->~value_type(); #if defined(BOOST_NO_CXX11_ALLOCATOR) - const_cast(static_cast( - this))->deallocate(ptr,1); + const_cast(static_cast( + this))->deallocate(ptr,1); #else - allocator_traits::deallocate(this->get_allocator(),ptr,1); + allocator_traits::deallocate(this->get_allocator(),ptr,1); #endif + } } };