From: risso Date: Fri, 10 Jun 2005 03:48:56 +0000 (+0000) Subject: Fixed a leak in pcap_open_live (win32): the pcap_t handle was not freed X-Git-Tag: libpcap-0.9.1~7 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/b34a667cf09762b4bb457f18d79da0cf2d98dc9d Fixed a leak in pcap_open_live (win32): the pcap_t handle was not freed if PacketOpenAdapter fails. --- diff --git a/pcap-win32.c b/pcap-win32.c index ddc57fcc..a0778c43 100644 --- a/pcap-win32.c +++ b/pcap-win32.c @@ -32,7 +32,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap-win32.c,v 1.25.2.1 2005-05-03 18:54:38 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-win32.c,v 1.25.2.2 2005-06-10 03:48:56 risso Exp $ (LBL)"; #endif #include @@ -411,6 +411,7 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, if (p->adapter == NULL) { + free(p); /* Adapter detected but we are not able to open it. Return failure. */ snprintf(ebuf, PCAP_ERRBUF_SIZE, "Error opening adapter: %s", pcap_win32strerror()); return NULL;