summaryrefslogtreecommitdiff
path: root/pcap-airpcap.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-09-27 10:32:40 -0700
committerGuy Harris <gharris@sonic.net>2020-09-27 10:32:40 -0700
commit2d3a47d5386d11c6e6c141afd50bdb56e2b087ce (patch)
treeb17fc2487da6b5ea9e1e9f8bc8abdd9889d09b6a /pcap-airpcap.c
parentde155ae5b74aeae3327d8b60d1be203d02f765c1 (diff)
downloadlibpcap-2d3a47d5386d11c6e6c141afd50bdb56e2b087ce.tar.gz
Clean up allocation of some lists.
Always heck wehther the allocation succeeds, and fail if it doesn't. Set the count of elements of the list only if the list was successfully allocated. For stylistic consistency, also seet it after we've set all the elements of the list.
Diffstat (limited to 'pcap-airpcap.c')
-rw-r--r--pcap-airpcap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pcap-airpcap.c b/pcap-airpcap.c
index 46b7dd51..703f23ac 100644
--- a/pcap-airpcap.c
+++ b/pcap-airpcap.c
@@ -895,10 +895,10 @@ airpcap_activate(pcap_t *p)
p->dlt_list = (u_int *) malloc(sizeof(u_int) * 3);
if (p->dlt_list == NULL)
goto bad;
- p->dlt_count = 3;
p->dlt_list[0] = DLT_IEEE802_11_RADIO;
p->dlt_list[1] = DLT_PPI;
p->dlt_list[2] = DLT_IEEE802_11;
+ p->dlt_count = 3;
p->read_op = airpcap_read;
p->inject_op = airpcap_inject;