summaryrefslogtreecommitdiffstats
path: root/src/heartbeat.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 /src/heartbeat.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 'src/heartbeat.c')
-rw-r--r--src/heartbeat.c6
1 files changed, 3 insertions, 3 deletions
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
74{ 74{
75 *client = NULL; 75 *client = NULL;
76 76
77 debug_info("Creating heartbeat_client, port = %d.", service->port); 77 if (!device || !service || service->port == 0 || !client || *client) {
78
79 if (!device || service->port == 0 || !client || *client) {
80 debug_info("Incorrect parameter passed to heartbeat_client_new."); 78 debug_info("Incorrect parameter passed to heartbeat_client_new.");
81 return HEARTBEAT_E_INVALID_ARG; 79 return HEARTBEAT_E_INVALID_ARG;
82 } 80 }
83 81
82 debug_info("Creating heartbeat_client, port = %d.", service->port);
83
84 property_list_service_client_t plclient = NULL; 84 property_list_service_client_t plclient = NULL;
85 heartbeat_error_t ret = heartbeat_error(property_list_service_client_new(device, service, &plclient)); 85 heartbeat_error_t ret = heartbeat_error(property_list_service_client_new(device, service, &plclient));
86 if (ret != HEARTBEAT_E_SUCCESS) { 86 if (ret != HEARTBEAT_E_SUCCESS) {