Subject: Re: [PATCH 05/28] fetch-pack: free object filter before exiting

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 26 Sep 2024 15:49:59 +0200

On Tue, Sep 24, 2024 at 05:52:07PM -0400, Jeff King wrote:
> Our fetch_pack_args holds a filter_options struct that may be populated
> with allocated strings by the by the "--filter" command-line option. We

s/by the by the/by the/

> must free it before exiting to avoid a leak when the program exits.
> 
> The usual fetch code paths that use transport.c don't have the same
> leak, because we do the cleanup in disconnect_git().
> 
> Fixing this leak lets us mark t5500 as leak-free.
> 
> Signed-off-by: Jeff King <[email-masked]>
> ---
>  builtin/fetch-pack.c  | 1 +
>  t/t5500-fetch-pack.sh | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
> index c5319232a5..cfc6951d23 100644
> --- a/builtin/fetch-pack.c
> +++ b/builtin/fetch-pack.c
> @@ -293,5 +293,6 @@ int cmd_fetch_pack(int argc,
>  	free(sought);
>  	free_refs(fetched_refs);
>  	free_refs(remote_refs);
> +	list_objects_filter_release(&args.filter_options);
>  	return ret;
>  }

This fix seems familiar to me, I think I also had it at one point in
time. Cannot find it in any of my series though, so... *shrug* Anyway,
this looks good to me.

Patrick