Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2010 20:20:46 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r209007 - stable/8/sys/net80211
Message-ID:  <201006102020.o5AKKkQc054880@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Thu Jun 10 20:20:46 2010
New Revision: 209007
URL: http://svn.freebsd.org/changeset/base/209007

Log:
  MFC r208699:
   Fix resource leaks in ieee80211_ioctl_setchanlist() in case of error.
  
  Found with:	Coverity Prevent(tm)
  CID:		4115
  Approved by:   re (kensmith)

Modified:
  stable/8/sys/net80211/ieee80211_ioctl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- stable/8/sys/net80211/ieee80211_ioctl.c	Thu Jun 10 20:15:45 2010	(r209006)
+++ stable/8/sys/net80211/ieee80211_ioctl.c	Thu Jun 10 20:20:46 2010	(r209007)
@@ -1590,8 +1590,10 @@ ieee80211_ioctl_setchanlist(struct ieee8
 	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 ieee8
 			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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006102020.o5AKKkQc054880>