]> The Tcpdump Group git mirrors - tcpdump/commitdiff
There is no need to use strdup() for options
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 17 Dec 2015 21:04:09 +0000 (22:04 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 17 Dec 2015 22:21:49 +0000 (23:21 +0100)
The other options don't use it.

tcpdump.c

index 02a6aa517e20427031455f36356dcbe772921b1a..d8f0129c622cd473d414489303d1ff987d30f767 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1119,15 +1119,11 @@ main(int argc, char **argv)
                        break;
 #endif
                case 'z':
-                       zflag = strdup(optarg);
-                       if (zflag == NULL)
-                               error("Unable to allocate memory for -z argument");
+                       zflag = optarg;
                        break;
 
                case 'Z':
-                       username = strdup(optarg);
-                       if (username == NULL)
-                               error("Unable to allocate memory for -Z argument");
+                       username = optarg;
                        break;
 
                case '#':