1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

wtap fix malloc/free.

* Remove malloc/free pointer cast;
* Check return value from malloc;

Submitted by: glebius
Approved by: adrian (mentor)
This commit is contained in:
Monthadar Al Jaberi 2012-12-18 16:11:13 +00:00
parent 263bbda93d
commit e605766a04
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244399

View File

@ -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 */