From ffb22e4bfed53757134689e2ef79a92bed8bb64a Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Wed, 6 Feb 2019 02:35:56 +0000 Subject: [PATCH] MFC r343682: sys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and drop unneeded cast. --- sys/dev/wtap/if_wtap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/wtap/if_wtap.c b/sys/dev/wtap/if_wtap.c index a32f9b802a8f..efc72031c09a 100644 --- a/sys/dev/wtap/if_wtap.c +++ b/sys/dev/wtap/if_wtap.c @@ -371,7 +371,7 @@ wtap_vap_delete(struct ieee80211vap *vap) destroy_dev(avp->av_dev); callout_stop(&avp->av_swba); ieee80211_vap_detach(vap); - free((struct wtap_vap*) vap, M_80211_VAP); + free(avp, M_80211_VAP); } /* NB: This function is not used. @@ -744,6 +744,8 @@ wtap_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) ni = malloc(sizeof(struct ieee80211_node), M_80211_NODE, M_NOWAIT|M_ZERO); + if (ni == NULL) + return (NULL); ni->ni_txrate = 130; return ni;