]> The Tcpdump Group git mirrors - libpcap/commitdiff
No, that's not an issue - it'll be a strdup() in any case, and safe to
authorGuy Harris <[email protected]>
Wed, 12 Aug 2009 05:10:51 +0000 (22:10 -0700)
committerGuy Harris <[email protected]>
Wed, 12 Aug 2009 05:10:51 +0000 (22:10 -0700)
free.  Revert previous change.

pcap.c
savefile.c

diff --git a/pcap.c b/pcap.c
index 1599d10b890e6dcf98a2eb2e23e8d22d8c3449d1..c9b461c46affcacaf7533f688e25b6d5dfa797af 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -190,14 +190,12 @@ pcap_create_common(const char *source, char *ebuf)
        p->fd = -1;     /* not opened yet */
 #endif 
 
-       if (source != NULL) {
-               p->opt.source = strdup(source);
-               if (p->opt.source == NULL) {
-                       snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
-                           pcap_strerror(errno));
-                       free(p);
-                       return (NULL);
-               }
+       p->opt.source = strdup(source);
+       if (p->opt.source == NULL) {
+               snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
+                   pcap_strerror(errno));
+               free(p);
+               return (NULL);
        }
 
        /*
index b501b6a5cf039892f93ccfa6023c8ebd5211aaf3..67da51fd629f82f50e0b19088ba2b584a54415c8 100644 (file)
@@ -1361,7 +1361,7 @@ pcap_fopen_offline(FILE *fp, char *errbuf)
        bpf_u_int32 magic;
        int linklen;
 
-       p = pcap_create_common(NULL, errbuf);
+       p = pcap_create_common("(savefile)", errbuf);
        if (p == NULL)
                return (NULL);