summaryrefslogtreecommitdiffstats
path: root/dev/ideviceclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'dev/ideviceclient.c')
-rw-r--r--dev/ideviceclient.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/dev/ideviceclient.c b/dev/ideviceclient.c
index c8635d8..778f20e 100644
--- a/dev/ideviceclient.c
+++ b/dev/ideviceclient.c
@@ -49,7 +49,7 @@ static void perform_notification(idevice_t phone, lockdownd_client_t client, con
np_client_t np;
lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service);
- if (service->port) {
+ if (service && service->port) {
printf("::::::::::::::: np was started ::::::::::::\n");
np_client_new(phone, service, &np);
if (np) {
@@ -109,15 +109,10 @@ int main(int argc, char *argv[])
lockdownd_start_service(client, "com.apple.afc", &service);
- if (service->port) {
+ if (service && service->port) {
afc_client_t afc = NULL;
afc_client_new(phone, service, &afc);
- if (service) {
- lockdownd_service_descriptor_free(service);
- service = NULL;
- }
-
if (afc) {
service->port = 0;
service->ssl_enabled = 0;
@@ -129,11 +124,6 @@ int main(int argc, char *argv[])
printf("ERROR: Notification proxy could not be started.\n");
}
- if (service) {
- lockdownd_service_descriptor_free(service);
- service = NULL;
- }
-
if (gnp) {
const char *nspec[5] = {
NP_SYNC_CANCEL_REQUEST,
@@ -266,6 +256,9 @@ int main(int argc, char *argv[])
}
afc_client_free(afc);
+
+ lockdownd_service_descriptor_free(service);
+ service = NULL;
} else {
printf("Start service failure.\n");
}