From acbe95725031771b6a6fdee836d50e350e637900 Mon Sep 17 00:00:00 2001 From: uncor3 Date: Fri, 20 Mar 2026 03:10:02 +0000 Subject: [PATCH] refactor: implement proper cleanup in init_idescriptor_device --- src/core/services/init_device.cpp | 33 +++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/core/services/init_device.cpp b/src/core/services/init_device.cpp index 23c17c2..480be0b 100644 --- a/src/core/services/init_device.cpp +++ b/src/core/services/init_device.cpp @@ -530,13 +530,6 @@ void init_idescriptor_device(const iDescriptor::Uniq &uniq, // dont cleanup here, afc2 is optional } - // FIXME: will probably not work on iOS 17 and above - // requires dev image disk - // err = location_simulation_connect(provider, &location_simulation); - // if (err) { - // qDebug() << "Failed to create Location Simulation client"; - // goto cleanup; - // } get_device_info_xml(uniq.get().toUtf8().constData(), lockdown, infoXml); lockdownd_get_value(lockdown, "EnableWifiConnections", @@ -570,24 +563,22 @@ void init_idescriptor_device(const iDescriptor::Uniq &uniq, } cleanup: // Cleanup on error - // FIXME: implement proper cleanup - // one of them causes a crash here, needs investigation result.error = err; if (!result.success) { qDebug() << "Initialization failed, cleaning up resources." << err->message; - // if (afc2_client) - // afc_client_free(afc2_client); - // if (afc_client) - // afc_client_free(afc_client); - // if (lockdown) - // lockdownd_client_free(lockdown); - // if (provider) - // idevice_provider_free(provider); - // if (addr_handle) - // idevice_usbmuxd_addr_free(addr_handle); - // if (usbmuxd_conn) - // idevice_usbmuxd_connection_free(usbmuxd_conn); + if (afc2_client) + afc_client_free(afc2_client); + if (afc_client) + afc_client_free(afc_client); + if (lockdown) + lockdownd_client_free(lockdown); + if (addr_handle) + idevice_usbmuxd_addr_free(addr_handle); + if (usbmuxd_conn) + idevice_usbmuxd_connection_free(usbmuxd_conn); + if (provider) + idevice_provider_free(provider); } }