summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lockdown.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 5c51120..c78d691 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -251,13 +251,17 @@ lockdownd_error_t lockdownd_client_free(lockdownd_client_t client)
251 * Sets the label to send for requests to lockdownd. 251 * Sets the label to send for requests to lockdownd.
252 * 252 *
253 * @param client The lockdown client 253 * @param client The lockdown client
254 * @param label The label to set or NULL to disable 254 * @param label The label to set or NULL to disable sending a label
255 * 255 *
256 */ 256 */
257void lockdownd_client_set_label(lockdownd_client_t client, const char *label) 257void lockdownd_client_set_label(lockdownd_client_t client, const char *label)
258{ 258{
259 if (client) 259 if (client) {
260 client->label = strdup(label); 260 if (client->label)
261 free(client->label);
262
263 client->label = (label != NULL) ? strdup(label): NULL;
264 }
261} 265}
262 266
263/** Polls the iPhone for lockdownd data. 267/** Polls the iPhone for lockdownd data.
@@ -644,7 +648,9 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_
644 client_loc->in_SSL = 0; 648 client_loc->in_SSL = 0;
645 client_loc->session_id = NULL; 649 client_loc->session_id = NULL;
646 client_loc->uuid = NULL; 650 client_loc->uuid = NULL;
647 client_loc->label = strdup(label); 651 client_loc->label = NULL;
652 if (label != NULL)
653 strdup(label);
648 654
649 if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc, &type)) { 655 if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc, &type)) {
650 log_debug_msg("%s: QueryType failed in the lockdownd client.\n", __func__); 656 log_debug_msg("%s: QueryType failed in the lockdownd client.\n", __func__);