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

Re: [PATCH] rebase: use child_process_clear() to clean

From
Jeff King <peff@peff.net>
Date
Mar 22, 2024, 23:36 UTC
Message-ID
<20240322233656.GB2049941@coredump.intra.peff.net>
In-Reply-To
<xmqqedc218to.fsf@gitster.g>
On Fri, Mar 22, 2024 at 10:21:23AM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> > We should use child_process_clear() instead, which covers both. And more
> > importantly, it future proofs us against the struct ever growing more
> > allocated fields.
> 
> When 21853626 (built-in rebase: call `git am` directly, 2019-01-18)
> started using run_command() API to drive "am", there already was
> child_process API and child_process_clear() did clear both .args and
> .env_array members but we used argv_array_clear() only to clear
> am.args, leaking am.env_array.

Ah, interesting. I didn't bother to dig into the history. Back then, though, I think that "args" was the only allocated thing. The env call was added much later in be0d29d301 (rebase --apply: make reflog messages match rebase --merge, 2022-10-12).

> I wonder what are in .env array at this point, though, but that is
> mere curiosity and not a problem with this patch.
It's $GIT_REFLOG_ACTION for the sub-process.
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “rebase: use child_process_clear() to clean”
  1. rebase: use child_process_clear() to cleanJeff King, Mar 22, 2024
  2. Junio C HamanoMar 22, 2024
  3. Jeff KingMar 22, 2024
  4. Junio C HamanoMar 25, 2024

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.