summaryrefslogtreecommitdiffstats
path: root/tools/idevicename.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-06-07 23:34:47 +0200
committerGravatar Nikias Bassen2020-06-07 23:34:47 +0200
commitce4f7a33eb6bb539db2ad856e2c19a4cdf6ca3ee (patch)
tree19d06556794cdfdc31e5539c35f6a42abf457939 /tools/idevicename.c
parentfb99e7c9d22c7d07b3b5fdb5064d3aa6cef88e62 (diff)
downloadlibimobiledevice-ce4f7a33eb6bb539db2ad856e2c19a4cdf6ca3ee.tar.gz
libimobiledevice-ce4f7a33eb6bb539db2ad856e2c19a4cdf6ca3ee.tar.bz2
tools: Avoid copying optarg where possible
Diffstat (limited to 'tools/idevicename.c')
-rw-r--r--tools/idevicename.c9
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)
{ 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;
}