diff options
author | Nikias Bassen | 2014-05-01 14:01:56 +0200 |
---|---|---|
committer | Nikias Bassen | 2014-05-01 14:01:56 +0200 |
commit | f9084ecb1a2274793e3819457920fc5c18f59140 (patch) | |
tree | 0cec88af5f1db759724c063571aad8e64129ef5d | |
parent | 7aa87fe71df068e798fe002ac785477d4e22c918 (diff) | |
download | ideviceinstaller-f9084ecb1a2274793e3819457920fc5c18f59140.tar.gz ideviceinstaller-f9084ecb1a2274793e3819457920fc5c18f59140.tar.bz2 |
Plug some small memory leaks
-rw-r--r-- | src/ideviceinstaller.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index fc22446..256e841 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c @@ -554,6 +554,7 @@ int main(int argc, char **argv) idevice_t phone = NULL; lockdownd_client_t client = NULL; instproxy_client_t ipc = NULL; + instproxy_error_t err; np_client_t np = NULL; afc_client_t afc = NULL; #ifdef HAVE_LIBIMOBILEDEVICE_1_1_5 @@ -587,7 +588,16 @@ int main(int argc, char **argv) goto leave_cleanup; } - if (np_client_new(phone, service, &np) != NP_E_SUCCESS) { + np_error_t nperr = np_client_new(phone, service, &np); +#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5 + if (service) { + lockdownd_service_descriptor_free(service); + } + service = NULL; +#else + service = 0; +#endif + if (nperr != NP_E_SUCCESS) { fprintf(stderr, "Could not connect to notification_proxy!\n"); goto leave_cleanup; } @@ -618,7 +628,16 @@ run_again: goto leave_cleanup; } - if (instproxy_client_new(phone, service, &ipc) != INSTPROXY_E_SUCCESS) { + err = instproxy_client_new(phone, service, &ipc); +#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5 + if (service) { + lockdownd_service_descriptor_free(service); + } + service = NULL; +#else + service = 0; +#endif + if (err != INSTPROXY_E_SUCCESS) { fprintf(stderr, "Could not connect to installation_proxy!\n"); goto leave_cleanup; } @@ -635,7 +654,6 @@ run_again: int xml_mode = 0; plist_t client_opts = instproxy_client_options_new(); instproxy_client_options_add(client_opts, "ApplicationType", "User", NULL); - instproxy_error_t err; plist_t apps = NULL; /* look for options */ @@ -1056,7 +1074,6 @@ run_again: int xml_mode = 0; plist_t dict = NULL; plist_t lres = NULL; - instproxy_error_t err; /* look for options */ if (options) { |