spacejam/sled

If the assertion goes into unwinding, the value will be leaked inside a panic.

labyrinth-ssr opened this issue · 0 comments

sled/src/lazy.rs

Lines 88 to 92 in 69294e5

let value = (self.init)();
let value_ptr = Box::into_raw(Box::new(value));
let old = self.value.swap(value_ptr, SeqCst);
assert!(old.is_null());

If the assert fails, the object value_ptr pointing to (which is on the heap) will leak.