Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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