From 2d3a47d5386d11c6e6c141afd50bdb56e2b087ce Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 27 Sep 2020 10:32:40 -0700 Subject: 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. --- pcap-airpcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pcap-airpcap.c') 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; -- cgit v1.2.1