From 542f7c9107c963628672fe851214fe0d7492a8ae Mon Sep 17 00:00:00 2001 From: xoffio <38369407+Xoffio@users.noreply.github.com> Date: Mon, 30 Sep 2024 08:05:52 -0400 Subject: [PATCH] fix issue when dropping DeviceManager --- frida/src/device_manager.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frida/src/device_manager.rs b/frida/src/device_manager.rs index e57ab11..a80abfd 100644 --- a/frida/src/device_manager.rs +++ b/frida/src/device_manager.rs @@ -147,6 +147,14 @@ impl<'a> DeviceManager<'a> { impl<'a> Drop for DeviceManager<'a> { fn drop(&mut self) { - unsafe { frida_sys::frida_unref(self.manager_ptr as _) } + let mut error: *mut frida_sys::GError = std::ptr::null_mut(); + unsafe { + frida_sys::frida_device_manager_close_sync( + self.manager_ptr, + std::ptr::null_mut(), + &mut error, + ); + frida_sys::frida_unref(self.manager_ptr as _) + } } }