diff --git a/evthread.c b/evthread.c index 9b263b79..26d2a564 100644 --- a/evthread.c +++ b/evthread.c @@ -402,8 +402,9 @@ evthread_setup_global_lock_(void *lock_, unsigned locktype, int enable_locks) } else { /* Case 4: Fill in a debug lock with a real lock */ struct debug_lock *lock = lock_ ? lock_ : debug_lock_alloc(locktype); - EVUTIL_ASSERT(enable_locks && - evthread_lock_debugging_enabled_); + if (!lock) + return NULL; + EVUTIL_ASSERT(enable_locks && evthread_lock_debugging_enabled_); EVUTIL_ASSERT(lock->locktype == locktype); if (!lock->lock) { lock->lock = original_lock_fns_.alloc(