Skip to content

Commit

Permalink
log: fix valgrind_test.v failure
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Feb 24, 2025
1 parent b9d0571 commit f3d2eb1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions vlib/log/safe_log.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ pub fn new_thread_safe_log() &ThreadSafeLog {
pub fn (mut x ThreadSafeLog) free() {
unsafe {
// make sure other threads are not in the blocks protected by the mutex:
mut p := x.mu
p.try_lock()
x.mu.try_lock()
x.mu.unlock()
x.mu.destroy()
free(x.mu)
x.mu = nil
p.unlock()
p.destroy()
free(p)
x.Log.free()
}
}
Expand Down

0 comments on commit f3d2eb1

Please sign in to comment.