aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrisso <risso>2002-10-24 08:09:42 +0000
committerrisso <risso>2002-10-24 08:09:42 +0000
commit8b5f7cc99ecf9f4a5e076591730c358445f303a4 (patch)
tree19eb1c8a359447ec81a1080931de3d296051ed0c
parentde4c0d816c6a21bbfc72132e452652809d9fa110 (diff)
There was a bug in pcap_open_offline: in case of error, the returned pointer was freed but the open file was not closed. Thus, a handle on the opened file was kept and could not be released as the returned pointer was null.
-rw-r--r--savefile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/savefile.c b/savefile.c
index 7175ab4..1caba97 100644
--- a/savefile.c
+++ b/savefile.c
@@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.68 2002-10-18 08:46:15 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.69 2002-10-24 08:09:42 risso Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -483,6 +483,8 @@ pcap_open_offline(const char *fname, char *errbuf)
return (p);
bad:
+ if(fp)
+ fclose(fp);
free(p);
return (NULL);
}