summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Bastien Nocera2018-07-24 14:27:05 +0200
committerGravatar Bastien Nocera2018-07-24 14:36:27 +0200
commite46d17cadb3dd1259b0ca78dc80fc06fbf10c516 (patch)
tree12a64bb4f792b50e97eb12e1284ccf3a5d4c5f16 /tools
parent6358b721c2f4dfea1d8f9f84346da30b458ec441 (diff)
downloadlibimobiledevice-e46d17cadb3dd1259b0ca78dc80fc06fbf10c516.tar.gz
libimobiledevice-e46d17cadb3dd1259b0ca78dc80fc06fbf10c516.tar.bz2
ideviceimagemounter: Fix possible memleak in option parsing
If some arguments are passed multiple times, don't leak the memory used for the value of the first arguments passed.
Diffstat (limited to 'tools')
-rw-r--r--tools/ideviceimagemounter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index ad3222a..d56fa0c 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -104,12 +104,16 @@ static void parse_opts(int argc, char **argv)
print_usage(argc, argv);
exit(2);
}
+ if (udid)
+ free(udid);
udid = strdup(optarg);
break;
case 'l':
list_mode = 1;
break;
case 't':
+ if (imagetype)
+ free(imagetype);
imagetype = strdup(optarg);
break;
case 'x':