diff options
Diffstat (limited to 'src/restore.c')
-rw-r--r-- | src/restore.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/restore.c b/src/restore.c index 4e9d65a..591fd16 100644 --- a/src/restore.c +++ b/src/restore.c | |||
@@ -268,29 +268,27 @@ LIBIMOBILEDEVICE_API restored_error_t restored_query_value(restored_client_t cli | |||
268 | 268 | ||
269 | LIBIMOBILEDEVICE_API restored_error_t restored_get_value(restored_client_t client, const char *key, plist_t *value) | 269 | LIBIMOBILEDEVICE_API restored_error_t restored_get_value(restored_client_t client, const char *key, plist_t *value) |
270 | { | 270 | { |
271 | plist_t item; | ||
272 | |||
271 | if (!client || !value || (value && *value)) | 273 | if (!client || !value || (value && *value)) |
272 | return RESTORE_E_INVALID_ARG; | 274 | return RESTORE_E_INVALID_ARG; |
273 | 275 | ||
274 | if (!client->info) | 276 | if (!client->info) |
275 | return RESTORE_E_NOT_ENOUGH_DATA; | 277 | return RESTORE_E_NOT_ENOUGH_DATA; |
276 | 278 | ||
277 | restored_error_t ret = RESTORE_E_SUCCESS; | ||
278 | plist_t item = NULL; | ||
279 | |||
280 | if (!key) { | 279 | if (!key) { |
281 | *value = plist_copy(client->info); | 280 | *value = plist_copy(client->info); |
282 | return RESTORE_E_SUCCESS; | 281 | return RESTORE_E_SUCCESS; |
283 | } else { | ||
284 | item = plist_dict_get_item(client->info, key); | ||
285 | } | 282 | } |
286 | 283 | ||
287 | if (item) { | 284 | item = plist_dict_get_item(client->info, key); |
288 | *value = plist_copy(item); | 285 | if (!item) { |
289 | } else { | 286 | return RESTORE_E_PLIST_ERROR; |
290 | ret = RESTORE_E_PLIST_ERROR; | ||
291 | } | 287 | } |
292 | 288 | ||
293 | return ret; | 289 | *value = plist_copy(item); |
290 | free(item); | ||
291 | return RESTORE_E_SUCCESS; | ||
294 | } | 292 | } |
295 | 293 | ||
296 | LIBIMOBILEDEVICE_API restored_error_t restored_client_new(idevice_t device, restored_client_t *client, const char *label) | 294 | LIBIMOBILEDEVICE_API restored_error_t restored_client_new(idevice_t device, restored_client_t *client, const char *label) |