[Ocfs2-tools-devel] [PATCH] fsck.ocfs2: fix a minor memleak

Tristan tristan.ye at oracle.com
Thu Nov 5 18:49:40 PST 2009


Sunil Mushran wrote:
> Tristan wrote:
>> Sunil Mushran wrote:
>>> Tristan wrote:
>>>>
>>>> I guess memory should not be placed there, it should be following 
>>>> instead:
>>>>
>>>> else {
>>>>
>>>>         ret = OCFS2_ET_INTERNAL_FAILURE;
>>>>         goto out;
>>>>
>>>> }
>>>>
>>>> out:
>>>> if (dp)
>>>> free(dp);
>>>> ... 
>>> I would imagine you mean....
>>>
>>> out:
>>> if (ret && dp)
>>>  free(dp);
>> why need to '&&' with ret? shouldn't dp be released regardless of 
>> whatever the ret was?
>
> Why would we want to release it? We've just added it to the rb tree.
Yes, you're right. the release should be at the time of tree's 
destruction if successful.




More information about the Ocfs2-tools-devel mailing list