xfs
[Top] [All Lists]

Re: [PATCH] xfs: fix memory leak in xfs_dir2_node_removename

To: Roger Willcocks <roger@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] xfs: fix memory leak in xfs_dir2_node_removename
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Fri, 27 Sep 2013 15:04:32 -0500
Cc: Mark Tinguely <tinguely@xxxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1380310573.22649.1082.camel@xxxxxxxxxxxxxxxxxxxxxxxx>
References: <20130927130140.640252809@xxxxxxx> <1380310573.22649.1082.camel@xxxxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
On 9/27/13 2:36 PM, Roger Willcocks wrote:
> 
> On Fri, 2013-09-27 at 08:01 -0500, Mark Tinguely wrote:
>> plain text document attachment
>> (xfs-fix-leak-in-xfs_dir2_node_removename.patch)
>> Free the memory pointed to by state before returning on error from 
>> xfs_dir2_node_removename.c
>>
>> Signed-off-by: Mark Tinguely <tinguely@xxxxxxx>
>> ---
>> Found by Coverity (134681) in userspace, same patch applies there
>> also.
>>
> 
> Is the first hunk right ?
> 
> xfs_da_node_lookup_int called as
> 
>         error = xfs_da_node_lookup_int(state, &rval);
> 
> and returns with
> 
>         *result = retval;
>         return(0);
> 
> so, on return, error == 0 and rval == an error code. The next lines:
> 
>         if (error)
>                 rval = error;
> 
> won't change that. But previously if rval != EEXIST you returned rval.
> With the change below, you return error, which is zero.

Oh geez.  o_O . . . Thanks Roger.

3rd review's the charm? ;)

-Eric

<Prev in Thread] Current Thread [Next in Thread>