evthread: fix NULL dereference in evthread_setup_global_lock_()

This commit is contained in:
Azat Khuzhin 2024-02-18 19:31:12 +01:00
parent 2f27523e44
commit 6e4ea6c3f1

View File

@ -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(