diff options
Diffstat (limited to 'pcap-pf.c')
-rw-r--r-- | pcap-pf.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -404,14 +404,15 @@ pcap_activate_pf(pcap_t *p) * Ethernet framing). */ 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"); + err = PCAP_ERROR; + goto bad; } + p->dlt_list[0] = DLT_EN10MB; + p->dlt_list[1] = DLT_DOCSIS; + p->dlt_count = 2; break; case ENDT_FDDI: |