git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] pull: plug minor memory leak after using is_descendant_of()
Date: Fri, 19 Jun 2020 09:35:04 -0400	[thread overview]
Message-ID: <20200619133504.GC2540897@coredump.intra.peff.net> (raw)
In-Reply-To: <52a584ee-ce2f-4416-3e3c-97ff15b5c346@web.de>

On Fri, Jun 19, 2020 at 03:14:19PM +0200, René Scharfe wrote:

> cmd_pull() builds a commit_list to pass a single potential ancestor to
> is_descendant_of().  The latter leaves the list intact.  Release the
> allocated memory after the call.
> 
> Leaking in cmd_*() isn't a big deal, but sets a bad example for other
> users of is_descendant_of().

This also looks good to me.

> ---
> Patch generated with -U15 for easier review; only the pre-context is
> interesting, though.  --function-context would add even more noise.
> A --block-context option might be nice (include surrounding lines up to
> and including the previous and next lines with lower indentation). :)
> Or perhaps it's a sign that the function should be split up..

I wondered how:

  git -c diff.cpp.funcname='.*{' show --function-context

but think it always goes to the "^}" line, which is more than we want
(plus the start of the block is in the hunk header, which makes the
indentation look funky).

-Peff

      reply	other threads:[~2020-06-19 13:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 13:14 [PATCH] pull: plug minor memory leak after using is_descendant_of() René Scharfe
2020-06-19 13:35 ` Jeff King [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

  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=20200619133504.GC2540897@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /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).