log: fix valgrind_test.v failure

This commit is contained in:
Delyan Angelov 2025-02-24 19:21:47 +02:00
parent b9d057118c
commit f3d2eb1c24
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED

View file

@ -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()
}
}