From: Elijah Newren Date: Tue, 25 Jun 2024 17:30:48 GMT Subject: Re: [PATCH 03/11] remote: transfer ownership of memory in add_url(), etc Message-ID: In-Reply-To: <20240614102722.GC222445@coredump.intra.peff.net> On Fri, Jun 14, 2024 at 4:08 AM Jeff King wrote: > > Many of the internal functions in remote.c take const strings and store > them forever in instances of "struct remote". Since the functions are > internal and callers are aware of the convention, this seems to mostly > work and not cause leaks. But there are some issues: > > - it's impossible to clear any of the arrays, because the data > dependencies between them are too muddled (if you free() a string, > it might also be referenced from another array, causing a > user-after-free; but if you don't, that might be the last reference, s/user-after-free/use-after-free/ (Read the rest of the patch and it all looks good.)