Skip to content

Commit f3d2eb1

Browse files
committed
log: fix valgrind_test.v failure
1 parent b9d0571 commit f3d2eb1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

vlib/log/safe_log.v

+4-5
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ pub fn new_thread_safe_log() &ThreadSafeLog {
2424
pub fn (mut x ThreadSafeLog) free() {
2525
unsafe {
2626
// make sure other threads are not in the blocks protected by the mutex:
27-
mut p := x.mu
28-
p.try_lock()
27+
x.mu.try_lock()
28+
x.mu.unlock()
29+
x.mu.destroy()
30+
free(x.mu)
2931
x.mu = nil
30-
p.unlock()
31-
p.destroy()
32-
free(p)
3332
x.Log.free()
3433
}
3534
}

0 commit comments

Comments
 (0)