From: Junio C Hamano <gitster@pobox•com>
To: Jonathan Nieder <jrnieder@gmail•com>
Cc: Matthieu Moy <Matthieu.Moy@imag•fr>, git@vger•kernel.org
Subject: Re: [PATCH] builtin/log.c: fix minor memory leak
Date: Thu, 07 Aug 2014 12:28:41 -0700 [thread overview]
Message-ID: <xmqq1tssksk6.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140807180435.GD12427@google.com> (Jonathan Nieder's message of "Thu, 7 Aug 2014 11:04:35 -0700")
Jonathan Nieder <jrnieder@gmail•com> writes:
> Matthieu Moy wrote:
>
>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag•fr>
>> ---
>> Valgrind confirms, one less unreachable block ;-).
>
> This belongs in the commit message.
>
> [...]
>> --- a/builtin/log.c
>> +++ b/builtin/log.c
>> @@ -857,20 +857,21 @@ static void add_branch_description(struct strbuf *buf, const char *branch_name)
>> {
>> struct strbuf desc = STRBUF_INIT;
>> if (!branch_name || !*branch_name)
>> return;
>> read_branch_desc(&desc, branch_name);
>> if (desc.len) {
>> strbuf_addch(buf, '\n');
>> strbuf_addbuf(buf, &desc);
>> strbuf_addch(buf, '\n');
>> }
>> + strbuf_release(&desc);
>
> This is an old one. The leak was introduced by v1.7.9-rc1~1^2~12
> (format-patch: use branch description in cover letter, 2011-09-21).
>
> I was a little scared to see a leak in 'git log' code, since most of
> what log does involves looping over many commits. Luckily this one is
> only used in make_cover_letter to create a cover letter describing the
> single branch on the command line, making it is a small, one-time
> leak.
Exactly ;-).
>
> Less noise from static and dynamic analysis tools is still worthwhile,
> so for what it's worth,
>
> Reviewed-by: Jonathan Nieder <jrnieder@gmail•com>
>
> Thanks.
Thanks.
prev parent reply other threads:[~2014-08-07 19:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-07 17:13 [PATCH] builtin/log.c: fix minor memory leak Matthieu Moy
2014-08-07 18:04 ` Jonathan Nieder
2014-08-07 19:28 ` Junio C Hamano [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=xmqq1tssksk6.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=Matthieu.Moy@imag$(echo .)fr \
--cc=git@vger$(echo .)kernel.org \
--cc=jrnieder@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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