Skip to content

Commit b231835

Browse files
committed
std: fix double-free of mutex
1 parent 9881574 commit b231835

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/sys/unix/locks/pthread_mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl LazyInit for AllocatedMutex {
6464
// We're not allowed to pthread_mutex_destroy a locked mutex,
6565
// so check first if it's unlocked.
6666
if unsafe { libc::pthread_mutex_trylock(mutex.0.get()) == 0 } {
67-
unsafe { libc::pthread_mutex_destroy(mutex.0.get()) };
67+
unsafe { libc::pthread_mutex_unlock(mutex.0.get()) };
6868
drop(mutex);
6969
} else {
7070
// The mutex is locked. This happens if a MutexGuard is leaked.

0 commit comments

Comments
 (0)