summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-11 13:28:03 +0100
committerGravatar Martin Szulecki2010-01-11 13:28:03 +0100
commit3151cbe9969e1fb3b6fe2413b355b7f81ea62d2c (patch)
tree2847018c5e368b209c0789e28416105833a0752f /src
parent9fc8e73e75a55ba11c784ebdce2b31877ca3f39f (diff)
downloadlibimobiledevice-3151cbe9969e1fb3b6fe2413b355b7f81ea62d2c.tar.gz
libimobiledevice-3151cbe9969e1fb3b6fe2413b355b7f81ea62d2c.tar.bz2
Make sure we can pass NULL as lockdown label to disable sending one
Diffstat (limited to 'src')
-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)
* Sets the label to send for requests to lockdownd.
*
* @param client The lockdown client
- * @param label The label to set or NULL to disable
+ * @param label The label to set or NULL to disable sending a label
*
*/
void lockdownd_client_set_label(lockdownd_client_t client, const char *label)
{
- if (client)
- client->label = strdup(label);
+ if (client) {
+ if (client->label)
+ free(client->label);
+
+ client->label = (label != NULL) ? strdup(label): NULL;
+ }
}
/** Polls the iPhone for lockdownd data.
@@ -644,7 +648,9 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_
client_loc->in_SSL = 0;
client_loc->session_id = NULL;
client_loc->uuid = NULL;
- client_loc->label = strdup(label);
+ client_loc->label = NULL;
+ if (label != NULL)
+ strdup(label);
if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc, &type)) {
log_debug_msg("%s: QueryType failed in the lockdownd client.\n", __func__);