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/heartbeat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/heartbeat.c') diff --git a/src/heartbeat.c b/src/heartbeat.c index 0f8d2f3..cee852e 100644 --- a/src/heartbeat.c +++ b/src/heartbeat.c @@ -74,13 +74,13 @@ heartbeat_error_t heartbeat_client_new(idevice_t device, lockdownd_service_descr { *client = NULL; - debug_info("Creating heartbeat_client, port = %d.", service->port); - - if (!device || service->port == 0 || !client || *client) { + if (!device || !service || service->port == 0 || !client || *client) { debug_info("Incorrect parameter passed to heartbeat_client_new."); return HEARTBEAT_E_INVALID_ARG; } + debug_info("Creating heartbeat_client, port = %d.", service->port); + property_list_service_client_t plclient = NULL; heartbeat_error_t ret = heartbeat_error(property_list_service_client_new(device, service, &plclient)); if (ret != HEARTBEAT_E_SUCCESS) { -- cgit v1.1-32-gdbae