Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2012 17:13:00 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Monthadar Al Jaberi <monthadar@gmail.com>
Cc:        Monthadar Al Jaberi <monthadar@FreeBSD.org>, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r244389 - head/sys/dev/wtap
Message-ID:  <20121218131300.GP94420@FreeBSD.org>
In-Reply-To: <CA%2BsBSoLh1juy9DvVY9bv8oi%2BcHLWnrmV8pwO_3BgKAMmk9PZsw@mail.gmail.com>
References:  <201212180844.qBI8ixdX097633@svn.freebsd.org> <20121218085306.GK94420@FreeBSD.org> <CA%2BsBSoLh1juy9DvVY9bv8oi%2BcHLWnrmV8pwO_3BgKAMmk9PZsw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 18, 2012 at 12:30:53PM +0100, Monthadar Al Jaberi wrote:
M> On Tue, Dec 18, 2012 at 9:53 AM, Gleb Smirnoff <glebius@freebsd.org> wrote:
M> >   Monthadar,
M> >
M> > On Tue, Dec 18, 2012 at 08:44:59AM +0000, Monthadar Al Jaberi wrote:
M> > M> Author: monthadar
M> > M> Date: Tue Dec 18 08:44:59 2012
M> > M> New Revision: 244389
M> > M> URL: http://svnweb.freebsd.org/changeset/base/244389
M> > M>
M> > M> Log:
M> > M>   wtap should check if ieee80211_vap_setup fails.
M> > M>
M> > M>   * If ieee80211_vap_setup fails, we free allocated M_80211_VAP
M> > M>     memory and return NULL;
M> > M>
M> > M>   Approved by: adrian (mentor)
M> > M>
M> > M> Modified:
M> > M>   head/sys/dev/wtap/if_wtap.c
M> > M>
M> > M> Modified: head/sys/dev/wtap/if_wtap.c
M> > M> ==============================================================================
M> > M> --- head/sys/dev/wtap/if_wtap.c      Tue Dec 18 08:41:23 2012        (r244388)
M> > M> +++ head/sys/dev/wtap/if_wtap.c      Tue Dec 18 08:44:59 2012        (r244389)
M> > M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic,
M> > M>      vap = (struct ieee80211vap *) avp;
M> > M>      error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS,
M> > M>          flags | IEEE80211_CLONE_NOBEACONS, bssid, mac);
M> > M> +    if (error) {
M> > M> +            free((struct wtap_vap*) vap, M_80211_VAP);
M> > M> +            return NULL;
M> > M> +    }
M> > M>
M> > M>      /* override various methods */
M> > M>      avp->av_recv_mgmt = vap->iv_recv_mgmt;
M> >
M> > You don't need to cast first argument of free(9). And you don't need a cast
M> > before malloc(9) as well.
M> >
M> > If you are calling malloc(9) with M_NOWAIT, you need to check return result.
M> >
M> > Also, more stylish would be to supply to free() the same variable that was
M> > assigned at malloc(9) call, in this particular case it is "avp".
M> >
M> > Patch attached.
M> 
M> Thank you for the patch, I can commit it for you, if you havn't done it yet?

Please commit, I'm not confident with wtap.

-- 
Totus tuus, Glebius.



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