diff options
author | monthadar <monthadar@FreeBSD.org> | 2012-12-18 16:11:13 +0000 |
---|---|---|
committer | monthadar <monthadar@FreeBSD.org> | 2012-12-18 16:11:13 +0000 |
commit | dd21ce809fd77c851007618df254203aea224205 (patch) | |
tree | ec049a0a4ac5849b6cbe61435a73253ed17fd353 /sys/dev/wtap | |
parent | 64407055dd260dcc160e027d51f7629849f22a25 (diff) | |
download | FreeBSD-src-dd21ce809fd77c851007618df254203aea224205.zip FreeBSD-src-dd21ce809fd77c851007618df254203aea224205.tar.gz |
wtap fix malloc/free.
* Remove malloc/free pointer cast;
* Check return value from malloc;
Submitted by: glebius
Approved by: adrian (mentor)
Diffstat (limited to 'sys/dev/wtap')
-rw-r--r-- | sys/dev/wtap/if_wtap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/wtap/if_wtap.c b/sys/dev/wtap/if_wtap.c index 1095b77..c86545e 100644 --- a/sys/dev/wtap/if_wtap.c +++ b/sys/dev/wtap/if_wtap.c @@ -326,8 +326,9 @@ wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], DWTAP_PRINTF("%s\n", __func__); - avp = (struct wtap_vap *) malloc(sizeof(struct wtap_vap), - M_80211_VAP, M_NOWAIT | M_ZERO); + avp = malloc(sizeof(struct wtap_vap), M_80211_VAP, M_NOWAIT | M_ZERO); + if (avp == NULL) + return (NULL); avp->id = sc->id; avp->av_md = sc->sc_md; avp->av_bcinterval = msecs_to_ticks(BEACON_INTRERVAL + 100*sc->id); @@ -335,8 +336,8 @@ wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); if (error) { - free((struct wtap_vap*) vap, M_80211_VAP); - return NULL; + free(avp, M_80211_VAP); + return (NULL); } /* override various methods */ |