svn commit: r261085 - head/sys/geom

John-Mark Gurney jmg at funkthat.com
Fri Jan 24 00:24:32 UTC 2014


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."


More information about the svn-src-all mailing list