summaryrefslogtreecommitdiffstats
path: root/dev/ideviceclient.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-03-14 03:09:14 +0100
committerGravatar Nikias Bassen2013-03-14 03:09:14 +0100
commit4222bc1b880d6535462e3b5ba5431809a3c5fddc (patch)
treeb664bbdfe96d162930b2719ec920cd149684b0ed /dev/ideviceclient.c
parent23abc8303b8cad9251cd4ea4b5fa5af28e5f0b24 (diff)
downloadlibimobiledevice-4222bc1b880d6535462e3b5ba5431809a3c5fddc.tar.gz
libimobiledevice-4222bc1b880d6535462e3b5ba5431809a3c5fddc.tar.bz2
global: make sure to check service before checking service->port to prevent crashes
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");
}