Skip to content

Commit c796402

Browse files
authored
refactor: mark TskBox::into_raw safe (#623)
1 parent 77bdf75 commit c796402

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/sys/table_collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ impl TableCollection {
107107
}
108108

109109
pub fn into_raw(self) -> *mut tsk_table_collection_t {
110-
unsafe { self.0.into_raw() }
110+
self.0.into_raw()
111111
}
112112
}

src/sys/tskbox.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ where
8585
}
8686
}
8787

88-
/// # Safety
88+
/// # Note
8989
///
9090
/// The returned pointer is no longer managed, meaing
9191
/// that it is the caller's responsibility to properly
@@ -94,7 +94,7 @@ where
9494
/// Failing to do so will may result in a
9595
/// memory leak.
9696
#[allow(dead_code)]
97-
pub unsafe fn into_raw(self) -> *mut T {
97+
pub fn into_raw(self) -> *mut T {
9898
let mut s = self;
9999
let rv = s.as_mut_ptr();
100100
s.owning = false;
@@ -189,7 +189,7 @@ fn test_into_raw_miri() {
189189
})
190190
.unwrap();
191191

192-
let p = unsafe { b.into_raw() };
192+
let p = b.into_raw();
193193

194194
unsafe { libc::free(p as *mut libc::c_void) }
195195
}

0 commit comments

Comments
 (0)