aboutsummaryrefslogtreecommitdiff
path: root/pcap-bpf.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-bpf.c')
-rw-r--r--pcap-bpf.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/pcap-bpf.c b/pcap-bpf.c
index 4e3c2819..26bc25db 100644
--- a/pcap-bpf.c
+++ b/pcap-bpf.c
@@ -2460,14 +2460,15 @@ pcap_activate_bpf(pcap_t *p)
*/
if (v == DLT_EN10MB && p->dlt_count == 0) {
p->dlt_list = (u_int *) malloc(sizeof(u_int) * 2);
- /*
- * If that fails, just leave the list empty.
- */
- if (p->dlt_list != NULL) {
- p->dlt_list[0] = DLT_EN10MB;
- p->dlt_list[1] = DLT_DOCSIS;
- p->dlt_count = 2;
+ if (p->dlt_list == NULL) {
+ pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
+ errno, "malloc");
+ status = PCAP_ERROR;
+ goto bad;
}
+ p->dlt_list[0] = DLT_EN10MB;
+ p->dlt_list[1] = DLT_DOCSIS;
+ p->dlt_count = 2;
}
#ifdef PCAP_FDDIPAD
if (v == DLT_FDDI)