[Ocfs2-tools-devel] [PATCH] Fix memleak which calculating number of extents

Tristan Ye tristan.ye at oracle.com
Thu Feb 3 04:39:14 PST 2011


Goldwyn Rodrigues wrote:
> Hi Tristan,
>
> On Wed, Feb 2, 2011 at 7:08 PM, Tristan Ye <tristan.ye at oracle.com> wrote:
>> ACK
>>
>> Goldwyn Rodrigues wrote:
>>> While calculating extents calc_num_extents() does not free the buffers
>>> allocated in the loop.
>>>
>>> Found by Joel Becker while reviewing defrag.ocfs2
>>>
>>> Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.de>
>>> ---
>>> diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
>>> index 1f60049..ae12479 100644
>>> --- a/debugfs.ocfs2/commands.c
>>> +++ b/debugfs.ocfs2/commands.c
>>> @@ -2092,6 +2092,7 @@ static errcode_t calc_num_extents(ocfs2_filesys *fs,
>>>                       if (ret)
>>>                               goto bail;
>>>
>>> +                     ocfs2_free(&buf);
>> Add:
>>    buf = NULL;
>>
>
> Why? ocfs2_free() sets the pointer to NULL.

Sorry for the noise, you're right;-)


>
>>>               }
>>>
>>>               *ne = *ne + extents;
>>>
>
> Regards,
>




More information about the Ocfs2-tools-devel mailing list