Re: [PATCH v2] checkout: plug some leaks in git-restore
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 14, 2024, 18:57 UTC
- Message-ID
- <xmqq8r2kvdy4.fsf@gitster.g>
- In-Reply-To
- <64c1c3cc-51d7-4168-9731-4389889e1449@gmail.com>
Rubén Justo <rjusto@gmail.com> writes:
Show 15 quoted lines
> 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.