Commit f82f6509 authored by Peter Gerber's avatar Peter Gerber
Browse files

Panic if lock managed by `locking_function` is doubly unlocked

Trying to unlock an unlocked lock is always an error and should
be treated as such.

This is related to #597.
parent bf63f35d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -576,7 +576,7 @@ unsafe extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char,
    if mode & ::CRYPTO_LOCK != 0 {
        (*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
    } else {
        &(*GUARDS)[n as usize].take();
        &(*GUARDS)[n as usize].take().expect("lock already unlocked");
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -719,7 +719,7 @@ unsafe extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char,
    if mode & ::CRYPTO_LOCK != 0 {
        (*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
    } else {
        &(*GUARDS)[n as usize].take();
        &(*GUARDS)[n as usize].take().expect("lock already unlocked");
    }
}