]> The Tcpdump Group git mirrors - libpcap/commitdiff
Free the port string before returning.
authorGuy Harris <[email protected]>
Sun, 21 Jan 2018 18:09:05 +0000 (10:09 -0800)
committerGuy Harris <[email protected]>
Sun, 21 Jan 2018 18:09:05 +0000 (10:09 -0800)
This should fix Coverity CID 1418990.

pcap.c

diff --git a/pcap.c b/pcap.c
index 5dbdf1a3b86b025681a8a8fa2683a3778694fd7e..80045949d13c3ed00d3a821dda5288e75515d125 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -1853,6 +1853,7 @@ pcap_parsesrcstr(const char *source, int *type, char *host, char *port,
                if (type)
                        *type = PCAP_SRC_IFLOCAL;
                free(tmppath);
+               free(tmpport);
                free(tmphost);
                free(tmpuserinfo);
                return (0);
@@ -1879,6 +1880,7 @@ pcap_parsesrcstr(const char *source, int *type, char *host, char *port,
                if (type)
                        *type = PCAP_SRC_IFREMOTE;
                free(tmppath);
+               free(tmpport);
                free(tmphost);
                free(tmpuserinfo);
                free(scheme);
@@ -1894,6 +1896,7 @@ pcap_parsesrcstr(const char *source, int *type, char *host, char *port,
                if (type)
                        *type = PCAP_SRC_FILE;
                free(tmppath);
+               free(tmpport);
                free(tmphost);
                free(tmpuserinfo);
                free(scheme);