Ticket #10058: once_possible_null_pointer.patch

File once_possible_null_pointer.patch, 1.0 KB (added by michael.kaes@…, 8 years ago)

Patch agains the current git repo

  • src/pthread/once.cpp

    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  
    88#include "./once_atomic.cpp"
    99#else
    1010#define __STDC_CONSTANT_MACROS
     11#include <boost/throw_exception.hpp>
    1112#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
    1213#include <boost/thread/once.hpp>
    1314#include <boost/assert.hpp>
    namespace boost  
    6768            if(!data)
    6869            {
    6970                data=malloc(sizeof(thread_detail::uintmax_atomic_t));
     71                                if(!data) boost::throw_exception(std::bad_aaloc());
    7072                BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data));
    7173                *static_cast<thread_detail::uintmax_atomic_t*>(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C;
    7274            }