Update ffi_alloc.rs

This commit is contained in:
THE-Amrit-mahto-05
2026-02-02 19:18:47 +05:30
committed by GitHub
parent 925907b75f
commit 858b8450ae

View File

@@ -4,12 +4,7 @@ extern "C" {
fn free(ptr: *mut c_void);
}
/// Frees memory allocated by C code (malloc/calloc)
///
/// # Safety
///
/// The pointer must have been allocated by C's malloc/calloc/realloc and
/// not yet freed. Calling this function with a pointer that was not
/// allocated by the C allocator is undefined behavior.
#[inline]
pub unsafe fn c_free<T>(ptr: *mut T) {
if !ptr.is_null() {