Subject: Re: [PATCH v2] checkout: plug some leaks in git-restore

From: Junio C Hamano <[email-masked]>
Date: Thu, 14 Mar 2024 11:57:39 -0700

Rubén Justo <[email-masked]> writes:

> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 4fe049cf37..2e8b0d18f4 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -1704,10 +1704,11 @@ static char cb_option = 'b';
>  
>  static int checkout_main(int argc, const char **argv, const char *prefix,
>  			 struct checkout_opts *opts, struct option *options,
> -			 const char * const usagestr[],
> -			 struct branch_info *new_branch_info)
> +			 const char * const usagestr[])
>  {
>  	int parseopt_flags = 0;
> +	struct branch_info new_branch_info = { 0 };
> +	int ret;

Ah, nice.  This is one thing I missed.

The callers of checkout_main() do not even care about the
new_branch_info structure so there is no point having them allocate
and pass a pointer to one to call this function.

The remainder is just as expected.  Will queue.  Thanks.