mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
False drop libplist from Rust
This commit is contained in:
@@ -197,7 +197,7 @@ pub unsafe extern "C" fn installation_proxy_get_apps(
|
||||
let res: Result<Vec<*mut c_void>, IdeviceError> = RUNTIME.block_on(async {
|
||||
client.0.get_apps(app_type, bundle_ids).await.map(|apps| {
|
||||
apps.into_values()
|
||||
.map(|v| util::plist_to_libplist(&v).get_pointer())
|
||||
.map(|v| util::plist_to_libplist(&v))
|
||||
.collect()
|
||||
})
|
||||
});
|
||||
|
||||
@@ -136,6 +136,7 @@ pub unsafe extern "C" fn idevice_pairing_file_serialize(
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn idevice_pairing_file_free(pairing_file: *mut IdevicePairingFile) {
|
||||
if !pairing_file.is_null() {
|
||||
log::debug!("Freeing pairing file");
|
||||
let _ = unsafe { Box::from_raw(pairing_file) };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +77,13 @@ pub(crate) fn c_addr_to_rust(addr: *const libc::sockaddr) -> Result<IpAddr, Idev
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn plist_to_libplist(v: &Value) -> plist_plus::Plist {
|
||||
pub(crate) fn plist_to_libplist(v: &Value) -> *mut libc::c_void {
|
||||
let buf = Vec::new();
|
||||
let mut writer = std::io::BufWriter::new(buf);
|
||||
plist::to_writer_xml(&mut writer, v).unwrap();
|
||||
let buf = String::from_utf8(writer.into_inner().unwrap()).unwrap();
|
||||
plist_plus::Plist::from_xml(buf).unwrap()
|
||||
let p = plist_plus::Plist::from_xml(buf).unwrap();
|
||||
let ptr = p.get_pointer();
|
||||
p.false_drop();
|
||||
ptr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user