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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:47

Ammon Riley [off-list ref] 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.

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

From: Ammon Riley <hidden>
Date: 2016-06-15 22:46:47

On Sat, May 16, 2009 at 12:56 PM, Junio C Hamano [off-list ref] wrote:
Ammon Riley [off-list ref] writes:
quoted
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.

Cheers,
Ammon
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help