Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jan 2014 16:24:25 -0800
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        svn-src-head@FreeBSD.org, "Andrey V. Elsukov" <ae@FreeBSD.org>, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r261085 - head/sys/geom
Message-ID:  <20140124002425.GB75135@funkthat.com>
In-Reply-To: <20140123201748.GA26772@dft-labs.eu>
References:  <201401231931.s0NJVHKS089308@svn.freebsd.org> <20140123201748.GA26772@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
Mateusz Guzik wrote this message on Thu, Jan 23, 2014 at 21:17 +0100:
> On Thu, Jan 23, 2014 at 07:31:17PM +0000, Andrey V. Elsukov wrote:
> > @@ -122,7 +123,7 @@ geom_alloc_copyin(struct gctl_req *req, 
> >  	void *ptr;
> >  
> >  	ptr = g_malloc(len, M_WAITOK);
> > -	nreq->nerror = copyin(uaddr, ptr, len);
> > +	req->nerror = copyin(uaddr, ptr, len);
> >  	if (!req->nerror)
> >  		return (ptr);
> >  	if (ptr != NULL)
> 
> Is not this if (ptr != NULL) unnecesary?

The code:
        if (!req->nerror)
                return (ptr);
        if (ptr != NULL)
                g_free(ptr);
        return (NULL);

If anything, the if statement can be removed, but the g_free needs to
remain, otherwise there will be a memory leak...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



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