From owner-svn-src-all@FreeBSD.ORG Tue Dec 18 16:11:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3DBD2939; Tue, 18 Dec 2012 16:11:14 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 22B598FC0A; Tue, 18 Dec 2012 16:11:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIGBEwO079707; Tue, 18 Dec 2012 16:11:14 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIGBDIT079705; Tue, 18 Dec 2012 16:11:13 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201212181611.qBIGBDIT079705@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 18 Dec 2012 16:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244399 - head/sys/dev/wtap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 16:11:14 -0000 Author: monthadar Date: Tue Dec 18 16:11:13 2012 New Revision: 244399 URL: http://svnweb.freebsd.org/changeset/base/244399 Log: wtap fix malloc/free. * Remove malloc/free pointer cast; * Check return value from malloc; Submitted by: glebius Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 14:32:53 2012 (r244398) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 16:11:13 2012 (r244399) @@ -326,8 +326,9 @@ wtap_vap_create(struct ieee80211com *ic, 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, 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 */