aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-dlpi.c
diff options
context:
space:
mode:
authorguy <guy>2001-11-11 22:32:28 +0000
committerguy <guy>2001-11-11 22:32:28 +0000
commit366751fb69694ac9428398d36f22d314b054d58c (patch)
treed3f57a9ba89e725a9f611986dba460014c6bf39d /pcap-dlpi.c
parent88d9e6cb243caa6891d9da11717729af06b0d76a (diff)
Close a file descriptor leak, as per a patch that comes with Nessus and
Pavel Kankovsky's suggested fix to that patch.
Diffstat (limited to 'pcap-dlpi.c')
-rw-r--r--pcap-dlpi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pcap-dlpi.c b/pcap-dlpi.c
index d5e40e8..8d99f2b 100644
--- a/pcap-dlpi.c
+++ b/pcap-dlpi.c
@@ -38,7 +38,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.71 2001-10-12 06:43:43 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.72 2001-11-11 22:32:28 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -262,6 +262,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
return (NULL);
}
memset(p, 0, sizeof(*p));
+ p->fd = -1; /* indicate that it hasn't been opened yet */
#ifdef HAVE_DEV_DLPI
/*
@@ -574,6 +575,8 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
return (p);
bad:
+ if (p->fd >= 0)
+ close(p->fd);
free(p);
return (NULL);
}