git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] rerere: fix memory leak if rerere images can't be read
Date: Tue, 23 Feb 2010 22:56:20 +0100	[thread overview]
Message-ID: <36ca99e91002231356u189b80ebka7ae8caf89ab9c10@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.1002232225480.3980@intel-tinevez-2-302>

On Tue, Feb 23, 2010 at 22:26, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Tue, 23 Feb 2010, Bert Wesarg wrote:
>
>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>> ---
>>  rerere.c |    6 ++++--
>>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> Looks good to me, except...
>
>> diff --git a/rerere.c b/rerere.c
>> index d1d3e75..9ca4cb8 100644
>> --- a/rerere.c
>> +++ b/rerere.c
>> @@ -364,16 +364,17 @@ static int find_conflict(struct string_list *conflict)
>>  static int merge(const char *name, const char *path)
>>  {
>>       int ret;
>> -     mmfile_t cur, base, other;
>> +     mmfile_t cur = {NULL, 0}, base = {NULL, 0}, other = {NULL, 0};
>>       mmbuffer_t result = {NULL, 0};
>>
>>       if (handle_file(path, NULL, rerere_path(name, "thisimage")) < 0)
>>               return 1;
>>
>> +     ret = 1;
>
> This initialization can come earlier, at declaration time.
I thought about it, but I think it is clearer to put just in front of
the condition which may fail.

Bye,
Bert

  reply	other threads:[~2010-02-23 21:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23 20:11 [PATCH] rerere: fix memory leak if rerere images can't be read Bert Wesarg
2010-02-23 21:26 ` Johannes Schindelin
2010-02-23 21:56   ` Bert Wesarg [this message]
2010-02-23 22:12     ` Johannes Schindelin
2010-02-23 22:53     ` Junio C Hamano

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=36ca99e91002231356u189b80ebka7ae8caf89ab9c10@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --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).