]> The Tcpdump Group git mirrors - libpcap/commitdiff
Close handles on error.
authorHenri Doreau <[email protected]>
Sun, 13 Mar 2011 14:02:25 +0000 (07:02 -0700)
committerGuy Harris <[email protected]>
Sun, 13 Mar 2011 14:02:25 +0000 (07:02 -0700)
Reviewed-By: Guy Harris <[email protected]>
pcap-linux.c

index 5d291e955aa11356434fafc9d73e8ab2a8984d56..c7542417f403b1a9962628f50745d546e6b991bc 100644 (file)
@@ -1880,6 +1880,7 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf)
        if (fd < 0) {
                (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "socket: %s", pcap_strerror(errno));
        if (fd < 0) {
                (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "socket: %s", pcap_strerror(errno));
+               (void)closedir(sys_class_net_d);
                return (-1);
        }
 
                return (-1);
        }
 
@@ -2013,6 +2014,7 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf)
        if (fd < 0) {
                (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "socket: %s", pcap_strerror(errno));
        if (fd < 0) {
                (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "socket: %s", pcap_strerror(errno));
+               (void)fclose(proc_net_f);
                return (-1);
        }
 
                return (-1);
        }