pub unsafe fn malloc_and_copy_bytes(data: &[u8], out_len: *mut usize) -> *mut u8Expand description
Helper to allocate memory via malloc, copy Rust slice data into it, set the out_len pointer, and return the raw pointer. Returns null pointer on allocation failure.
ยงSafety
out_lenmust be a valid pointer tousize.- The caller must ensure the returned pointer (if not null) is eventually freed
using
ffi_free_bytes. - Operations involve raw pointers and calling
libc::malloc, requiringunsafeblock.