Merge pull request #601 from pgerber/double_unlock

Panic if lock managed by `locking_function` is doubly unlocked
This commit is contained in:
Steven Fackler 2017-03-17 11:32:02 -07:00 committed by GitHub
commit 3aec0a38bf
2 changed files with 2 additions and 2 deletions

View File

@ -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");
}
}

View File

@ -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");
}
}