aboutsummaryrefslogtreecommitdiffstats
path: root/savefile.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2009-08-11 22:06:38 -0700
committerGuy Harris <guy@alum.mit.edu>2009-08-11 22:06:38 -0700
commitb93bc35e51b26987822297ff6182f0865840fa10 (patch)
tree13acef006072c542a968437f4dcd79fd89b3c2ef /savefile.c
parent4e4c320e9fe0c5e6a197b1b8c617833bea2d44bc (diff)
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).
Diffstat (limited to 'savefile.c')
-rw-r--r--savefile.c8
1 files changed, 2 insertions, 6 deletions
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)) {