On Fri, Mar 22, 2024 at 10:21:23AM -0700, Junio C Hamano wrote: > > 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