From cb8a4a27bb4c0971ac2063286a48753f228f5c61 Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Sat, 31 May 2014 18:19:43 +0200 Subject: [PATCH] Throw if malloc fails. --- src/pthread/once.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pthread/once.cpp b/src/pthread/once.cpp index 89c62e7b..2cfe7cd1 100644 --- a/src/pthread/once.cpp +++ b/src/pthread/once.cpp @@ -11,6 +11,7 @@ #include #include #include +#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_alloc()); BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data)); *static_cast(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C; }