diff options
| -rw-r--r-- | tools/ideviceimagemounter.c | 17 | ||||
| -rw-r--r-- | tools/ideviceinfo.c | 17 | ||||
| -rw-r--r-- | tools/idevicename.c | 9 | ||||
| -rw-r--r-- | tools/idevicesetlocation.c | 5 |
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 @@ | |||
| 51 | static int list_mode = 0; | 51 | static int list_mode = 0; |
| 52 | static int use_network = 0; | 52 | static int use_network = 0; |
| 53 | static int xml_mode = 0; | 53 | static int xml_mode = 0; |
| 54 | static char *udid = NULL; | 54 | static const char *udid = NULL; |
| 55 | static char *imagetype = NULL; | 55 | static const char *imagetype = NULL; |
| 56 | 56 | ||
| 57 | static const char PKG_PATH[] = "PublicStaging"; | 57 | static const char PKG_PATH[] = "PublicStaging"; |
| 58 | static const char PATH_PREFIX[] = "/private/var/mobile/Media"; | 58 | static const char PATH_PREFIX[] = "/private/var/mobile/Media"; |
| @@ -116,8 +116,7 @@ static void parse_opts(int argc, char **argv) | |||
| 116 | print_usage(argc, argv); | 116 | print_usage(argc, argv); |
| 117 | exit(2); | 117 | exit(2); |
| 118 | } | 118 | } |
| 119 | free(udid); | 119 | udid = optarg; |
| 120 | udid = strdup(optarg); | ||
| 121 | break; | 120 | break; |
| 122 | case 'n': | 121 | case 'n': |
| 123 | use_network = 1; | 122 | use_network = 1; |
| @@ -126,9 +125,7 @@ static void parse_opts(int argc, char **argv) | |||
| 126 | list_mode = 1; | 125 | list_mode = 1; |
| 127 | break; | 126 | break; |
| 128 | case 't': | 127 | case 't': |
| 129 | if (imagetype) | 128 | imagetype = optarg; |
| 130 | free(imagetype); | ||
| 131 | imagetype = strdup(optarg); | ||
| 132 | break; | 129 | break; |
| 133 | case 'x': | 130 | case 'x': |
| 134 | xml_mode = 1; | 131 | xml_mode = 1; |
| @@ -281,10 +278,9 @@ int main(int argc, char **argv) | |||
| 281 | if (list_mode) { | 278 | if (list_mode) { |
| 282 | /* list mounts mode */ | 279 | /* list mounts mode */ |
| 283 | if (!imagetype) { | 280 | if (!imagetype) { |
| 284 | imagetype = strdup("Developer"); | 281 | imagetype = "Developer"; |
| 285 | } | 282 | } |
| 286 | err = mobile_image_mounter_lookup_image(mim, imagetype, &result); | 283 | err = mobile_image_mounter_lookup_image(mim, imagetype, &result); |
| 287 | free(imagetype); | ||
| 288 | if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { | 284 | if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { |
| 289 | res = 0; | 285 | res = 0; |
| 290 | if (xml_mode) { | 286 | if (xml_mode) { |
| @@ -329,7 +325,7 @@ int main(int argc, char **argv) | |||
| 329 | 325 | ||
| 330 | 326 | ||
| 331 | if (!imagetype) { | 327 | if (!imagetype) { |
| 332 | imagetype = strdup("Developer"); | 328 | imagetype = "Developer"; |
| 333 | } | 329 | } |
| 334 | 330 | ||
| 335 | switch(disk_image_upload_type) { | 331 | switch(disk_image_upload_type) { |
| @@ -407,7 +403,6 @@ int main(int argc, char **argv) | |||
| 407 | 403 | ||
| 408 | printf("Mounting...\n"); | 404 | printf("Mounting...\n"); |
| 409 | err = mobile_image_mounter_mount_image(mim, mountname, sig, sig_length, imagetype, &result); | 405 | err = mobile_image_mounter_mount_image(mim, mountname, sig, sig_length, imagetype, &result); |
| 410 | free(imagetype); | ||
| 411 | if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { | 406 | if (err == MOBILE_IMAGE_MOUNTER_E_SUCCESS) { |
| 412 | if (result) { | 407 | if (result) { |
| 413 | plist_t node = plist_dict_get_item(result, "Status"); | 408 | 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[]) | |||
| 129 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 129 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| 130 | int simple = 0; | 130 | int simple = 0; |
| 131 | int format = FORMAT_KEY_VALUE; | 131 | int format = FORMAT_KEY_VALUE; |
| 132 | char* udid = NULL; | 132 | const char* udid = NULL; |
| 133 | int use_network = 0; | 133 | int use_network = 0; |
| 134 | char *domain = NULL; | 134 | const char *domain = NULL; |
| 135 | char *key = NULL; | 135 | const char *key = NULL; |
| 136 | char *xml_doc = NULL; | 136 | char *xml_doc = NULL; |
| 137 | uint32_t xml_length; | 137 | uint32_t xml_length; |
| 138 | plist_t node = NULL; | 138 | plist_t node = NULL; |
| @@ -166,8 +166,7 @@ int main(int argc, char *argv[]) | |||
| 166 | print_usage(argc, argv, 1); | 166 | print_usage(argc, argv, 1); |
| 167 | return 2; | 167 | return 2; |
| 168 | } | 168 | } |
| 169 | free(udid); | 169 | udid = optarg; |
| 170 | udid = strdup(optarg); | ||
| 171 | break; | 170 | break; |
| 172 | case 'n': | 171 | case 'n': |
| 173 | use_network = 1; | 172 | use_network = 1; |
| @@ -178,8 +177,7 @@ int main(int argc, char *argv[]) | |||
| 178 | print_usage(argc, argv, 1); | 177 | print_usage(argc, argv, 1); |
| 179 | return 2; | 178 | return 2; |
| 180 | } | 179 | } |
| 181 | free(domain); | 180 | domain = optarg; |
| 182 | domain = strdup(optarg); | ||
| 183 | break; | 181 | break; |
| 184 | case 'k': | 182 | case 'k': |
| 185 | if (!*optarg) { | 183 | if (!*optarg) { |
| @@ -187,8 +185,7 @@ int main(int argc, char *argv[]) | |||
| 187 | print_usage(argc, argv, 1); | 185 | print_usage(argc, argv, 1); |
| 188 | return 2; | 186 | return 2; |
| 189 | } | 187 | } |
| 190 | free(key); | 188 | key = optarg; |
| 191 | key = strdup(optarg); | ||
| 192 | break; | 189 | break; |
| 193 | case 'x': | 190 | case 'x': |
| 194 | format = FORMAT_XML; | 191 | format = FORMAT_XML; |
| @@ -255,8 +252,6 @@ int main(int argc, char *argv[]) | |||
| 255 | } | 252 | } |
| 256 | } | 253 | } |
| 257 | 254 | ||
| 258 | if (domain != NULL) | ||
| 259 | free(domain); | ||
| 260 | lockdownd_client_free(client); | 255 | lockdownd_client_free(client); |
| 261 | idevice_free(device); | 256 | idevice_free(device); |
| 262 | 257 | ||
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) | |||
| 66 | { NULL, 0, NULL, 0} | 66 | { NULL, 0, NULL, 0} |
| 67 | }; | 67 | }; |
| 68 | int res = -1; | 68 | int res = -1; |
| 69 | char* udid = NULL; | 69 | const char* udid = NULL; |
| 70 | int use_network = 0; | 70 | int use_network = 0; |
| 71 | 71 | ||
| 72 | #ifndef WIN32 | 72 | #ifndef WIN32 |
| @@ -81,8 +81,7 @@ int main(int argc, char** argv) | |||
| 81 | print_usage(); | 81 | print_usage(); |
| 82 | exit(2); | 82 | exit(2); |
| 83 | } | 83 | } |
| 84 | free(udid); | 84 | udid = optarg; |
| 85 | udid = strdup(optarg); | ||
| 86 | break; | 85 | break; |
| 87 | case 'n': | 86 | case 'n': |
| 88 | use_network = 1; | 87 | use_network = 1; |
| @@ -153,9 +152,5 @@ int main(int argc, char** argv) | |||
| 153 | lockdownd_client_free(lockdown); | 152 | lockdownd_client_free(lockdown); |
| 154 | idevice_free(device); | 153 | idevice_free(device); |
| 155 | 154 | ||
| 156 | if (udid) { | ||
| 157 | free(udid); | ||
| 158 | } | ||
| 159 | |||
| 160 | return res; | 155 | return res; |
| 161 | } | 156 | } |
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) | |||
| 76 | { NULL, 0, NULL, 0} | 76 | { NULL, 0, NULL, 0} |
| 77 | }; | 77 | }; |
| 78 | uint32_t mode = 0; | 78 | uint32_t mode = 0; |
| 79 | char *udid = NULL; | 79 | const char *udid = NULL; |
| 80 | int use_network = 0; | 80 | int use_network = 0; |
| 81 | 81 | ||
| 82 | while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) { | 82 | while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) { |
| @@ -90,8 +90,7 @@ int main(int argc, char **argv) | |||
| 90 | print_usage(argc, argv, 1); | 90 | print_usage(argc, argv, 1); |
| 91 | return 2; | 91 | return 2; |
| 92 | } | 92 | } |
| 93 | free(udid); | 93 | udid = optarg; |
| 94 | udid = strdup(optarg); | ||
| 95 | break; | 94 | break; |
| 96 | case 'n': | 95 | case 'n': |
| 97 | use_network = 1; | 96 | use_network = 1; |
