From 4222bc1b880d6535462e3b5ba5431809a3c5fddc Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 14 Mar 2013 03:09:14 +0100 Subject: global: make sure to check service before checking service->port to prevent crashes --- src/notification_proxy.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/notification_proxy.c') diff --git a/src/notification_proxy.c b/src/notification_proxy.c index 8fb9ad0..5b293f8 100644 --- a/src/notification_proxy.c +++ b/src/notification_proxy.c @@ -108,12 +108,10 @@ static np_error_t np_error(property_list_service_error_t err) */ np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client) { - if (!device) - return NP_E_INVALID_ARG; - property_list_service_client_t plistclient = NULL; - if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { - return NP_E_CONN_FAILED; + np_error_t err = np_error(property_list_service_client_new(device, service, &plistclient)); + if (err != NP_E_SUCCESS) { + return err; } np_client_t client_loc = (np_client_t) malloc(sizeof(struct np_client_private)); -- cgit v1.1-32-gdbae