From 79fc1ededbbafba3204b952cc022b089a38547dd Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 21 Jun 2014 00:59:38 +0200 Subject: idevicebackup2: Use afc_dictionary_free() helper instead of custom code --- tools/idevicebackup2.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'tools/idevicebackup2.c') diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 5f14862..35d3ccb 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -109,19 +109,6 @@ static void notify_cb(const char *notification, void *userdata) } } -static void free_dictionary(char **dictionary) -{ - int i = 0; - - if (!dictionary) - return; - - for (i = 0; dictionary[i]; i++) { - free(dictionary[i]); - } - free(dictionary); -} - static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *filename, char **data, uint64_t *size) { if (!afc || !data || !size) { @@ -130,7 +117,7 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil char **fileinfo = NULL; uint32_t fsize = 0; - + afc_get_file_info(afc, filename, &fileinfo); if (!fileinfo) { return; @@ -142,12 +129,12 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil break; } } - free_dictionary(fileinfo); + afc_dictionary_free(fileinfo); if (fsize == 0) { return; } - + uint64_t f = 0; afc_file_open(afc, filename, AFC_FOPEN_RDONLY, &f); if (!f) { -- cgit v1.1-32-gdbae