Re: [PATCH 03/11] remote: transfer ownership of memory in add_url(), etc
On Fri, Jun 14, 2024 at 4:08 AM Jeff King <peff@peff.net> wrote:
Show 10 quoted lines
>
> 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.)