diff options
| author | 2014-05-03 17:29:42 +0200 | |
|---|---|---|
| committer | 2014-05-03 17:29:42 +0200 | |
| commit | 5b3c3e2b49af4e11e378825d7167e71ee52b7c12 (patch) | |
| tree | 65f5ab56c97a2b88931b751cc66759059163a6a4 /tools | |
| parent | 269fc21990b39cb1bd7a46b223a9d948a07fedd3 (diff) | |
| download | libimobiledevice-5b3c3e2b49af4e11e378825d7167e71ee52b7c12.tar.gz libimobiledevice-5b3c3e2b49af4e11e378825d7167e71ee52b7c12.tar.bz2 | |
idevicebackup2: Make sure to free idevice object in error conditions
Diffstat (limited to 'tools')
| -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[])  	char *info_path = NULL;   	if (cmd == CMD_CHANGEPW) {  		if (!interactive_mode && !backup_password && !newpw) { +			idevice_free(device);  			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");  			return -1;  		} @@ -1552,6 +1553,7 @@ int main(int argc, char *argv[])  		info_path = build_path(backup_directory, source_udid, "Info.plist", NULL);  		if (cmd == CMD_RESTORE || cmd == CMD_UNBACK) {  			if (stat(info_path, &st) != 0) { +				idevice_free(device);  				free(info_path);  				printf("ERROR: Backup directory \"%s\" is invalid. No Info.plist found for UDID %s.\n", backup_directory, source_udid);  				return -1; @@ -1563,6 +1565,7 @@ int main(int argc, char *argv[])  			plist_t manifest_plist = NULL;  			plist_read_from_filename(&manifest_plist, manifest_path);  			if (!manifest_plist) { +				idevice_free(device);  				free(info_path);  				free(manifest_path);  				printf("ERROR: Backup directory \"%s\" is invalid. No Manifest.plist found for UDID %s.\n", backup_directory, source_udid); | 
