From dad632896037e39deb986a5fb9970f919b5ce507 Mon Sep 17 00:00:00 2001
From: Michael Kaes <michael.kaes@gmail.com>
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
|
b
|
|
8 | 8 | #include "./once_atomic.cpp" |
9 | 9 | #else |
10 | 10 | #define __STDC_CONSTANT_MACROS |
| 11 | #include <boost/throw_exception.hpp> |
11 | 12 | #include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp> |
12 | 13 | #include <boost/thread/once.hpp> |
13 | 14 | #include <boost/assert.hpp> |
… |
… |
namespace boost
|
67 | 68 | if(!data) |
68 | 69 | { |
69 | 70 | data=malloc(sizeof(thread_detail::uintmax_atomic_t)); |
| 71 | if(!data) boost::throw_exception(std::bad_aaloc()); |
70 | 72 | BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data)); |
71 | 73 | *static_cast<thread_detail::uintmax_atomic_t*>(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C; |
72 | 74 | } |