Re: [PATCH] Fix minor memory leak in init-db

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

 



On Sat, May 16, 2009 at 10:13 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Ammon Riley <ammon.riley@xxxxxxxxx> writes:
>
>> On Sat, May 16, 2009 at 12:56 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>> Ammon Riley <ammon.riley@xxxxxxxxx> writes:
>>>
>>>> There was an xmalloc() for path, but I didn't see a corresponding free().
>>>> Does it happen somewhere else that I'm not expecting?
>>>
>>> It implicitly happens in exit() in git.c:handle_internal_command()
>>> after cmd_init_db() returns the control to it.
>>
>> Ah. Naturally. :)
>>
>> So if I were to write a long-lived application (such as a custom UI) that
>> links to libgit, and bypasses those functions to call init_db() (and other
>> functions) directly, all those implicit free-on-exit() turn into memory
>> leaks.
>
> Correct, and there are other much larger issues to worry about.
>
> That's why there is a separate libgit2 effort in progress.

Okay, cool! I wasn't aware of that -- I'll take a look at it. In the meantime,
are small patches for this type of issue welcome if I run across others,
or would you prefer I let them lie?

Cheers,
Ammon
--
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]