Skip to content

Commit

Permalink
fix: Extender::extend_fn_once use after free
Browse files Browse the repository at this point in the history
  • Loading branch information
zetanumbers committed May 29, 2024
1 parent 5edc06e commit b9b8cc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ impl<'a, T> RefOnce<'a, T> {
impl<T: ?Sized> RefOnce<'_, T> {
// TODO: make public
fn into_raw(this: Self) -> *mut Once<T> {
ptr::addr_of_mut!(*this.slot)
let this = mem::ManuallyDrop::new(this);
unsafe { ptr::addr_of!(this.slot).read() }
}
}

Expand Down

0 comments on commit b9b8cc4

Please sign in to comment.