From 39d454d77d4eb200780d9c0a8fcfcd23c4f8fa1f Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Sat, 13 Dec 2025 11:41:33 -0700 Subject: [PATCH] Add function to free arbitrary stream handle --- ffi/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs index 2f74986..ff60a17 100644 --- a/ffi/src/lib.rs +++ b/ffi/src/lib.rs @@ -377,6 +377,17 @@ pub unsafe extern "C" fn idevice_free(idevice: *mut IdeviceHandle) { } } +/// Frees a stream handle +/// +/// # Safety +/// Pass a valid handle allocated by this library +#[unsafe(no_mangle)] +pub unsafe extern "C" fn idevice_stream_free(stream_handle: *mut ReadWriteOpaque) { + if !stream_handle.is_null() { + let _ = unsafe { Box::from_raw(stream_handle) }; + } +} + /// Frees a string allocated by this library /// /// # Arguments