MFC r208699:

Fix resource leaks in ieee80211_ioctl_setchanlist() in case of error.

Found with:	Coverity Prevent(tm)
CID:		4115
Approved by:   re (kensmith)
This commit is contained in:
Rui Paulo 2010-06-10 20:20:46 +00:00
parent 8301c66f4d
commit 58fba57ead
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=209007

View File

@ -1590,8 +1590,10 @@ ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq)
if (list == NULL)
return ENOMEM;
error = copyin(ireq->i_data, list, ireq->i_len);
if (error)
if (error) {
free(list, M_TEMP);
return error;
}
nchan = 0;
chanlist = list + ireq->i_len; /* NB: zero'd already */
maxchan = ireq->i_len * NBBY;
@ -1607,8 +1609,10 @@ ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq)
nchan++;
}
}
if (nchan == 0)
if (nchan == 0) {
free(list, M_TEMP);
return EINVAL;
}
if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && /* XXX */
isclr(chanlist, ic->ic_bsschan->ic_ieee))
ic->ic_bsschan = IEEE80211_CHAN_ANYC;