summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Mutex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Mutex.cpp')
-rw-r--r--llvm/lib/Support/Mutex.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/Mutex.cpp b/llvm/lib/Support/Mutex.cpp
index 7138c7a4b98..c70125f108e 100644
--- a/llvm/lib/Support/Mutex.cpp
+++ b/llvm/lib/Support/Mutex.cpp
@@ -47,7 +47,10 @@ MutexImpl::MutexImpl( bool recursive)
{
// Declare the pthread_mutex data structures
pthread_mutex_t* mutex =
- static_cast<pthread_mutex_t*>(safe_malloc(sizeof(pthread_mutex_t)));
+ static_cast<pthread_mutex_t*>(malloc(sizeof(pthread_mutex_t)));
+
+ if (mutex == nullptr)
+ report_bad_alloc_error("Mutex allocation failed");
pthread_mutexattr_t attr;
OpenPOWER on IntegriCloud