summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/ideviceimagemounter.c17
-rw-r--r--tools/ideviceinfo.c17
-rw-r--r--tools/idevicename.c9
-rw-r--r--tools/idevicesetlocation.c5
4 files changed, 16 insertions, 32 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index c89ddd3..325a9e2 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -51,8 +51,8 @@
static int list_mode = 0;
static int use_network = 0;
static int xml_mode = 0;
-static char *udid = NULL;
-static char *imagetype = NULL;
+static const char *udid = NULL;
+static const char *imagetype = NULL;
static const char PKG_PATH[] = "PublicStaging";
static const char PATH_PREFIX[] = "/private/var/mobile/Media";
@@ -116,8 +116,7 @@ static void parse_opts(int argc, char **argv)
print_usage(argc, argv);
exit(2);
}
- free(udid);
- udid = strdup(optarg);
+ udid = optarg;
break;
case 'n':
use_network = 1;
@@ -126,9 +125,7 @@ static void parse_opts(int argc, char **argv)
list_mode = 1;
break;
case 't':
- if (imagetype)
- free(imagetype);
- imagetype = strdup(optarg);
+ imagetype = optarg;
break;
case 'x':
xml_mode = 1;
@@ -281,10 +278,9 @@ int main(int argc, char **argv)
if (list_mode) {
/* list mounts mode */
if (!imagetype) {
- imagetype = strdup("Developer");
+ imagetype = "Developer";
}
err = mobile_image_mounter_lookup_image(mim, imagetype, &result);
- free(imagetype);
if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
res = 0;
if (xml_mode) {
@@ -329,7 +325,7 @@ int main(int argc, char **argv)
if (!imagetype) {
- imagetype = strdup("Developer");
+ imagetype = "Developer";
}
switch(disk_image_upload_type) {
@@ -407,7 +403,6 @@ int main(int argc, char **argv)
printf("Mounting...\n");
err = mobile_image_mounter_mount_image(mim, mountname, sig, sig_length, imagetype, &result);
- free(imagetype);
if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
if (result) {
plist_t node = plist_dict_get_item(result, "Status");
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index a222e69..d8260e0 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -129,10 +129,10 @@ int main(int argc, char *argv[])
idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int simple = 0;
int format = FORMAT_KEY_VALUE;
- char* udid = NULL;
+ const char* udid = NULL;
int use_network = 0;
- char *domain = NULL;
- char *key = NULL;
+ const char *domain = NULL;
+ const char *key = NULL;
char *xml_doc = NULL;
uint32_t xml_length;
plist_t node = NULL;
@@ -166,8 +166,7 @@ int main(int argc, char *argv[])
print_usage(argc, argv, 1);
return 2;
}
- free(udid);
- udid = strdup(optarg);
+ udid = optarg;
break;
case 'n':
use_network = 1;
@@ -178,8 +177,7 @@ int main(int argc, char *argv[])
print_usage(argc, argv, 1);
return 2;
}
- free(domain);
- domain = strdup(optarg);
+ domain = optarg;
break;
case 'k':
if (!*optarg) {
@@ -187,8 +185,7 @@ int main(int argc, char *argv[])
print_usage(argc, argv, 1);
return 2;
}
- free(key);
- key = strdup(optarg);
+ key = optarg;
break;
case 'x':
format = FORMAT_XML;
@@ -255,8 +252,6 @@ int main(int argc, char *argv[])
}
}
- if (domain != NULL)
- free(domain);
lockdownd_client_free(client);
idevice_free(device);
diff --git a/tools/idevicename.c b/tools/idevicename.c
index a87872b..97bf2d4 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -66,7 +66,7 @@ int main(int argc, char** argv)
{ NULL, 0, NULL, 0}
};
int res = -1;
- char* udid = NULL;
+ const char* udid = NULL;
int use_network = 0;
#ifndef WIN32
@@ -81,8 +81,7 @@ int main(int argc, char** argv)
print_usage();
exit(2);
}
- free(udid);
- udid = strdup(optarg);
+ udid = optarg;
break;
case 'n':
use_network = 1;
@@ -153,9 +152,5 @@ int main(int argc, char** argv)
lockdownd_client_free(lockdown);
idevice_free(device);
- if (udid) {
- free(udid);
- }
-
return res;
}
diff --git a/tools/idevicesetlocation.c b/tools/idevicesetlocation.c
index 6332e3c..ffa285e 100644
--- a/tools/idevicesetlocation.c
+++ b/tools/idevicesetlocation.c
@@ -76,7 +76,7 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0}
};
uint32_t mode = 0;
- char *udid = NULL;
+ const char *udid = NULL;
int use_network = 0;
while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) {
@@ -90,8 +90,7 @@ int main(int argc, char **argv)
print_usage(argc, argv, 1);
return 2;
}
- free(udid);
- udid = strdup(optarg);
+ udid = optarg;
break;
case 'n':
use_network = 1;