diff options
| author | 2010-01-11 13:28:03 +0100 | |
|---|---|---|
| committer | 2010-01-11 13:28:03 +0100 | |
| commit | 3151cbe9969e1fb3b6fe2413b355b7f81ea62d2c (patch) | |
| tree | 2847018c5e368b209c0789e28416105833a0752f | |
| parent | 9fc8e73e75a55ba11c784ebdce2b31877ca3f39f (diff) | |
| download | libimobiledevice-3151cbe9969e1fb3b6fe2413b355b7f81ea62d2c.tar.gz libimobiledevice-3151cbe9969e1fb3b6fe2413b355b7f81ea62d2c.tar.bz2 | |
Make sure we can pass NULL as lockdown label to disable sending one
| -rw-r--r-- | src/lockdown.c | 14 |
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 | */ |
| 257 | void lockdownd_client_set_label(lockdownd_client_t client, const char *label) | 257 | void 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__); |
