git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ammon Riley <ammon.riley@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fix minor memory leak in init-db
Date: Sun, 17 May 2009 09:09:17 -0700	[thread overview]
Message-ID: <cd3664ac0905170909l3184c286s7f7d61e108fd5b05@mail.gmail.com> (raw)
In-Reply-To: <7veiuojoqy.fsf@alter.siamese.dyndns.org>

On Sat, May 16, 2009 at 10:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ammon Riley <ammon.riley@gmail.com> writes:
>
>> 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.

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

      reply	other threads:[~2009-05-17 16:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 22:22 [PATCH] Fix minor memory leak in init-db Ammon Riley
2009-05-16 19:56 ` Junio C Hamano
2009-05-17  4:07   ` Ammon Riley
2009-05-17  5:13     ` Junio C Hamano
2009-05-17 16:09       ` Ammon Riley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd3664ac0905170909l3184c286s7f7d61e108fd5b05@mail.gmail.com \
    --to=ammon.riley@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).