Re: [PATCH 2/3] bundle.c: fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller <sbeller@xxxxxxxxxx> writes:

> On Tue, Mar 10, 2015 at 3:40 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> Stefan Beller <sbeller@xxxxxxxxxx> writes:
>>
>>> The continue statements nearby also have an accompanying free(ref);
>>>
>>> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
>>> ---
>>
>> I wonder what happens when dwim_ref() returned 2 or more, though.
>
> That should also be fixed I guess. I'll look into it.
>
> These one liner fixes are mostly done as a side project
> having fun, just doing what the code analysis tools says,
> sorry for not catching that one.
>
> Maybe instead of the reoccuring pattern
>
>     free(ref);
>     continue;
>
> we could just have a
>
>     goto cleanup
>
> which goes to the end of the loop where we have
> the free anyway.

Yeah, I suspect that the end result may look more like that if you
cover the dwim_ref() one as well.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]