From b93bc35e51b26987822297ff6182f0865840fa10 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 11 Aug 2009 22:06:38 -0700 Subject: From Dustin Spicuzza: use pcap_create_common() to allocate the pcap_t in pcap_fopen_offline(), so that we initialize various function pointers (not just the oneshot callback, but also functions such as the "can set rfmon mode" function). --- savefile.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'savefile.c') diff --git a/savefile.c b/savefile.c index e3687da..67da51f 100644 --- a/savefile.c +++ b/savefile.c @@ -1361,13 +1361,9 @@ pcap_fopen_offline(FILE *fp, char *errbuf) bpf_u_int32 magic; int linklen; - p = (pcap_t *)malloc(sizeof(*p)); - if (p == NULL) { - strlcpy(errbuf, "out of swap", PCAP_ERRBUF_SIZE); + p = pcap_create_common("(savefile)", errbuf); + if (p == NULL) return (NULL); - } - - memset((char *)p, 0, sizeof(*p)); amt_read = fread((char *)&hdr, 1, sizeof(hdr), fp); if (amt_read != sizeof(hdr)) { -- cgit v1.2.3