git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 17, 2009, 05:13 UTC
Message-ID
<7veiuojoqy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<cd3664ac0905162107t7ebca943p1722685a8484f08e@mail.gmail.com>
Ammon Riley <ammon.riley@gmail.com> writes:
Show 15 quoted lines
> On Sat, May 16, 2009 at 12:56 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Ammon Riley <ammon.riley@gmail.com> 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.
Previous: Ammon RileyNext: Ammon Riley
Message 4 of 5 in “Fix minor memory leak in init-db”
  1. Fix minor memory leak in init-dbAmmon Riley, May 14, 2009
  2. Junio C HamanoMay 16, 2009
  3. Ammon RileyMay 17, 2009
  4. Junio C HamanoMay 17, 2009
  5. Ammon RileyMay 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.