Re: [PATCH v2] remote: plug memory leaks
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 25, 2026, 17:06 UTC
- Message-ID
- <xmqq1pcryp6j.fsf@gitster.g>
- In-Reply-To
- <20260725161819.GA2343104@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 15 quoted lines
> We should not rely on that assumption, because we sometimes discard the > configset (e.g., when discovering the repo, or when writing a new config > option). I couldn't come up with a case that fails, but I think it is > mostly luck (or lack of imagination) that there is no code path that > invalidates the configset between when we read the remote config and > when we actually use it. > > So even though in something like: > > git -c url.$PWD.insteadOf=$PWD clone $PWD dst > > we end up with a state were the instead-of structs are broken, nobody is > reading them at that point. > > So I think this v2 is doing the right thing.
Thanks.
I had somebody else dig into the entire codebase and they claim that there is only one existing (ab)user of the configuration API that assumes that the configset-held strings will stay forever, which is the comment_line_string stuff that is stored from the configuration callback without getting copied. I do not necessarily believe it is the only one, but this particular code indeed seems to rely on the assumption. #leftoverbits perhaps.