Skip to content

Commit

Permalink
refactor: mark TskBox::into_raw safe (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen authored Apr 30, 2024
1 parent 77bdf75 commit c796402
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/sys/table_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ impl TableCollection {
}

pub fn into_raw(self) -> *mut tsk_table_collection_t {
unsafe { self.0.into_raw() }
self.0.into_raw()
}
}
6 changes: 3 additions & 3 deletions src/sys/tskbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ where
}
}

/// # Safety
/// # Note
///
/// The returned pointer is no longer managed, meaing
/// that it is the caller's responsibility to properly
Expand All @@ -94,7 +94,7 @@ where
/// Failing to do so will may result in a
/// memory leak.
#[allow(dead_code)]
pub unsafe fn into_raw(self) -> *mut T {
pub fn into_raw(self) -> *mut T {
let mut s = self;
let rv = s.as_mut_ptr();
s.owning = false;
Expand Down Expand Up @@ -189,7 +189,7 @@ fn test_into_raw_miri() {
})
.unwrap();

let p = unsafe { b.into_raw() };
let p = b.into_raw();

unsafe { libc::free(p as *mut libc::c_void) }
}
Expand Down

0 comments on commit c796402

Please sign in to comment.