git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, sunshine@sunshineco.com, tr@thomasrast.ch
Subject: Re: [PATCHv3 3/6] line-log.c: fix a memleak
Date: Mon, 30 Mar 2015 22:06:16 -0700	[thread overview]
Message-ID: <xmqqsiclsqlz.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1427764931-27745-4-git-send-email-sbeller@google.com> (Stefan Beller's message of "Mon, 30 Mar 2015 18:22:08 -0700")

Stefan Beller <sbeller@google.com> writes:

> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  line-log.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/line-log.c b/line-log.c
> index b43ac58..db6e58d 100644
> --- a/line-log.c
> +++ b/line-log.c
> @@ -1129,6 +1129,9 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c
>  	changed = process_all_files(&parent_range, rev, &queue, range);
>  	if (parent)
>  		add_line_range(rev, parent, parent_range);
> +	else
> +		free_line_log_data(parent_range);
> +

Should this be in the else clause?  From a cursory scan
add-line-range feeds it to either line-log-data-merge or
line-log-data-copy to create "new" that is a separate thing from the
parent_range we are feeding it, and that copy is used by
add-decoration.  If add-line-range does not take ownership of
parent_range from us, shouldn't we be freeing it whether we called
it or not???

>  	return changed;
>  }

  parent reply	other threads:[~2015-03-31  5:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31  1:22 [PATCHv3 0/6] Memory leaks once again Stefan Beller
2015-03-31  1:22 ` [PATCHv3 1/6] shallow: fix a memleak Stefan Beller
2015-03-31  2:52   ` Eric Sunshine
2015-03-31  1:22 ` [PATCHv3 2/6] line-log.c: " Stefan Beller
2015-03-31  1:22 ` [PATCHv3 3/6] " Stefan Beller
2015-03-31  4:42   ` Torsten Bögershausen
2015-03-31  5:06   ` Junio C Hamano [this message]
2015-03-31  5:35     ` Stefan Beller
2015-03-31 19:03       ` Junio C Hamano
2015-03-31  1:22 ` [PATCHv3 4/6] wt-status.c: " Stefan Beller
2015-03-31  1:22 ` [PATCHv3 5/6] pack-bitmap.c: " Stefan Beller
2015-03-31  3:32   ` Jeff King
2015-03-31  1:22 ` [PATCHv3 6/6] entry.c: " Stefan Beller
2015-03-31  5:41   ` Junio C Hamano
2015-03-31  8:36   ` John Keeping
2015-03-31 19:12     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqsiclsqlz.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    --cc=sunshine@sunshineco.com \
    --cc=tr@thomasrast.ch \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).