diff options
| author | 2020-06-07 23:34:47 +0200 | |
|---|---|---|
| committer | 2020-06-07 23:34:47 +0200 | |
| commit | ce4f7a33eb6bb539db2ad856e2c19a4cdf6ca3ee (patch) | |
| tree | 19d06556794cdfdc31e5539c35f6a42abf457939 /tools/idevicename.c | |
| parent | fb99e7c9d22c7d07b3b5fdb5064d3aa6cef88e62 (diff) | |
| download | libimobiledevice-ce4f7a33eb6bb539db2ad856e2c19a4cdf6ca3ee.tar.gz libimobiledevice-ce4f7a33eb6bb539db2ad856e2c19a4cdf6ca3ee.tar.bz2 | |
tools: Avoid copying optarg where possible
Diffstat (limited to 'tools/idevicename.c')
| -rw-r--r-- | tools/idevicename.c | 9 |
1 files changed, 2 insertions, 7 deletions
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 | } |
