From dad632896037e39deb986a5fb9970f919b5ce507 Mon Sep 17 00:00:00 2001 From: Michael Kaes Date: Mon, 19 May 2014 11:02:36 +0200 Subject: [PATCH] Fixed possible null pointer access --- src/pthread/once.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pthread/once.cpp b/src/pthread/once.cpp index 89c62e7..1f0b652 100644 --- a/src/pthread/once.cpp +++ b/src/pthread/once.cpp @@ -8,6 +8,7 @@ #include "./once_atomic.cpp" #else #define __STDC_CONSTANT_MACROS +#include #include #include #include @@ -67,6 +68,7 @@ namespace boost if(!data) { data=malloc(sizeof(thread_detail::uintmax_atomic_t)); + if(!data) boost::throw_exception(std::bad_aaloc()); BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data)); *static_cast(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C; } -- 1.9.1