Re: [PATCH 07/20] diff: refactor code to clarify memory ownership of prefixes
On Thu, May 23, 2024 at 8:26 AM Patrick Steinhardt <ps@pks.im> wrote:
> The source end destination prefixes are tracked in a `const char *`
Show 10 quoted lines
> array, but may at times contain allocated strings. The result is that
> those strings may be leaking because we never free them.
>
> Refactor the code to always store allocated strings in those variables,
> freeing them as required. This requires us to handle the default values
> a bit different compared to before. But given that there is only a
> single callsite where we use the variables to `struct diff_options` it's
> easy to handle the defaults there.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>