summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicebackup.c')
-rw-r--r--tools/idevicebackup.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index dbba217..8b862d6 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -820,9 +820,8 @@ int main(int argc, char *argv[])
{
idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int i;
- char udid[41];
+ char* udid = NULL;
uint16_t port = 0;
- udid[0] = 0;
int cmd = -1;
int is_full_backup = 0;
char *backup_directory = NULL;
@@ -858,7 +857,7 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
- strcpy(udid, argv[i]);
+ udid = strdup(argv[i]);
continue;
}
else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
@@ -911,7 +910,7 @@ int main(int argc, char *argv[])
printf("Backup directory is \"%s\"\n", backup_directory);
- if (udid[0] != 0) {
+ if (udid) {
ret = idevice_new(&phone, udid);
if (ret != IDEVICE_E_SUCCESS) {
printf("No device found with udid %s, is it plugged in?\n", udid);
@@ -1700,6 +1699,10 @@ files_out:
idevice_free(phone);
+ if (udid) {
+ free(udid);
+ }
+
return 0;
}