git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] pull: plug minor memory leak after using is_descendant_of()

From
Jeff King <peff@peff.net>
Date
Jun 19, 2020, 13:35 UTC
Message-ID
<20200619133504.GC2540897@coredump.intra.peff.net>
In-Reply-To
<52a584ee-ce2f-4416-3e3c-97ff15b5c346@web.de>
On Fri, Jun 19, 2020 at 03:14:19PM +0200, René Scharfe wrote:
Show 6 quoted lines
> 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.
Show 6 quoted lines
> ---
> 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
Previous: René Scharfe
Message 2 of 2 in “pull: plug minor memory leak after using is_descendant_of()”
  1. pull: plug minor memory leak after using is_descendant_of()René Scharfe, Jun 19, 2020
  2. Jeff KingJun 19, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.