diff options
| author | 2014-05-03 17:29:42 +0200 | |
|---|---|---|
| committer | 2014-05-03 17:29:42 +0200 | |
| commit | 5b3c3e2b49af4e11e378825d7167e71ee52b7c12 (patch) | |
| tree | 65f5ab56c97a2b88931b751cc66759059163a6a4 | |
| parent | 269fc21990b39cb1bd7a46b223a9d948a07fedd3 (diff) | |
| download | libimobiledevice-5b3c3e2b49af4e11e378825d7167e71ee52b7c12.tar.gz libimobiledevice-5b3c3e2b49af4e11e378825d7167e71ee52b7c12.tar.bz2 | |
idevicebackup2: Make sure to free idevice object in error conditions
| -rw-r--r-- | tools/idevicebackup2.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 39840e3..7576879 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -1544,6 +1544,7 @@ int main(int argc, char *argv[]) | |||
| 1544 | char *info_path = NULL; | 1544 | char *info_path = NULL; |
| 1545 | if (cmd == CMD_CHANGEPW) { | 1545 | if (cmd == CMD_CHANGEPW) { |
| 1546 | if (!interactive_mode && !backup_password && !newpw) { | 1546 | if (!interactive_mode && !backup_password && !newpw) { |
| 1547 | idevice_free(device); | ||
| 1547 | printf("ERROR: Can't get password input in non-interactive mode. Either pass password(s) on the command line, or enable interactive mode with -i or --interactive.\n"); | 1548 | printf("ERROR: Can't get password input in non-interactive mode. Either pass password(s) on the command line, or enable interactive mode with -i or --interactive.\n"); |
| 1548 | return -1; | 1549 | return -1; |
| 1549 | } | 1550 | } |
| @@ -1552,6 +1553,7 @@ int main(int argc, char *argv[]) | |||
| 1552 | info_path = build_path(backup_directory, source_udid, "Info.plist", NULL); | 1553 | info_path = build_path(backup_directory, source_udid, "Info.plist", NULL); |
| 1553 | if (cmd == CMD_RESTORE || cmd == CMD_UNBACK) { | 1554 | if (cmd == CMD_RESTORE || cmd == CMD_UNBACK) { |
| 1554 | if (stat(info_path, &st) != 0) { | 1555 | if (stat(info_path, &st) != 0) { |
| 1556 | idevice_free(device); | ||
| 1555 | free(info_path); | 1557 | free(info_path); |
| 1556 | printf("ERROR: Backup directory \"%s\" is invalid. No Info.plist found for UDID %s.\n", backup_directory, source_udid); | 1558 | printf("ERROR: Backup directory \"%s\" is invalid. No Info.plist found for UDID %s.\n", backup_directory, source_udid); |
| 1557 | return -1; | 1559 | return -1; |
| @@ -1563,6 +1565,7 @@ int main(int argc, char *argv[]) | |||
| 1563 | plist_t manifest_plist = NULL; | 1565 | plist_t manifest_plist = NULL; |
| 1564 | plist_read_from_filename(&manifest_plist, manifest_path); | 1566 | plist_read_from_filename(&manifest_plist, manifest_path); |
| 1565 | if (!manifest_plist) { | 1567 | if (!manifest_plist) { |
| 1568 | idevice_free(device); | ||
| 1566 | free(info_path); | 1569 | free(info_path); |
| 1567 | free(manifest_path); | 1570 | free(manifest_path); |
| 1568 | printf("ERROR: Backup directory \"%s\" is invalid. No Manifest.plist found for UDID %s.\n", backup_directory, source_udid); | 1571 | printf("ERROR: Backup directory \"%s\" is invalid. No Manifest.plist found for UDID %s.\n", backup_directory, source_udid); |
