diff options
author | Gisle Vanem <gisle.vanem@gmail.com> | 2020-02-25 10:04:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 10:04:21 +0100 |
commit | c0704f7b713f85b7b33478cc477448396c65dfdf (patch) | |
tree | aa306ac22937de564c1ef8d2151683dc5dd641c3 /testprogs/opentest.c | |
parent | 6da9b5cf3fc497a45a53d32875223e6a0ce812ed (diff) | |
download | libpcap-c0704f7b713f85b7b33478cc477448396c65dfdf.tar.gz |
Plug memory-leak
If the '-i' option is not used, the strdup() memory was not freed.
Diffstat (limited to 'testprogs/opentest.c')
-rw-r--r-- | testprogs/opentest.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/testprogs/opentest.c b/testprogs/opentest.c index 3c83a598..a441dda1 100644 --- a/testprogs/opentest.c +++ b/testprogs/opentest.c @@ -81,7 +81,7 @@ main(int argc, char **argv) switch (op) { case 'i': - device = optarg; + device = strdup(optarg); break; case 'I': @@ -192,6 +192,7 @@ main(int argc, char **argv) else printf("%s opened successfully\n", device); } + free(device); pcap_close(pd); exit(status < 0 ? 1 : 0); } |