From: Henri Doreau Date: Sun, 13 Mar 2011 14:02:25 +0000 (-0700) Subject: Close handles on error. X-Git-Tag: libpcap-1.2.1~78 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/e31ba4c82c27ab8a4952b9cde1c3ff5a3ddd122c Close handles on error. Reviewed-By: Guy Harris --- diff --git a/pcap-linux.c b/pcap-linux.c index 5d291e95..c7542417 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -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)); + (void)closedir(sys_class_net_d); 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)); + (void)fclose(proc_net_f); return (-1); }