diff options
Diffstat (limited to 'pcap-netfilter-linux.c')
-rw-r--r-- | pcap-netfilter-linux.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c index 23475aed..cfad2523 100644 --- a/pcap-netfilter-linux.c +++ b/pcap-netfilter-linux.c @@ -613,12 +613,15 @@ netfilter_activate(pcap_t* handle) if (type == NFLOG) { handle->linktype = DLT_NFLOG; handle->dlt_list = (u_int *) malloc(sizeof(u_int) * 2); - if (handle->dlt_list != NULL) { - handle->dlt_list[0] = DLT_NFLOG; - handle->dlt_list[1] = DLT_IPV4; - handle->dlt_count = 2; + if (handle->dlt_list == NULL) { + pcap_fmt_errmsg_for_errno(handle->errbuf, + PCAP_ERRBUF_SIZE, errno, + "Can't allocate DLT list"); + goto close_fail; } - + handle->dlt_list[0] = DLT_NFLOG; + handle->dlt_list[1] = DLT_IPV4; + handle->dlt_count = 2; } else handle->linktype = DLT_IPV4; |