git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Rubén Justo
Message 6 of 6 in “checkout: plug some leaks in git-restore”
  1. checkout: plug some leaks in git-restoreRubén Justo, Mar 14, 2024
  2. Eric SunshineMar 14, 2024
  3. checkout: plug some leaks in git-restoreRubén Justo, Mar 14, 2024
  4. Junio C HamanoMar 14, 2024
  5. checkout: plug some leaks in git-restoreRubén Justo, Mar 14, 2024
  6. Junio C HamanoMar 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.