diff options
Diffstat (limited to 'lib/Support/Mutex.cpp')
-rw-r--r-- | lib/Support/Mutex.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Support/Mutex.cpp b/lib/Support/Mutex.cpp index bdd02105f6f0..b1d5e7c0d991 100644 --- a/lib/Support/Mutex.cpp +++ b/lib/Support/Mutex.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Mutex.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Config/config.h" //===----------------------------------------------------------------------===// @@ -47,6 +48,10 @@ MutexImpl::MutexImpl( bool recursive) // Declare the pthread_mutex data structures pthread_mutex_t* mutex = static_cast<pthread_mutex_t*>(malloc(sizeof(pthread_mutex_t))); + + if (mutex == nullptr) + report_bad_alloc_error("Mutex allocation failed"); + pthread_mutexattr_t attr; // Initialize the mutex attributes |