Skip to content

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

@labyrinth-ssr

Description

@labyrinth-ssr

rio/src/lazy.rs

Lines 79 to 84 in 319f7fb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions