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

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 14, 2024, 02:39 UTC
Message-ID
<CAPig+cSYB3uNZhNGh6++5KA03ehv5pE+_KK1X=hUbb5JHwMoJQ@mail.gmail.com>
In-Reply-To
<04a9e001-5cd6-402c-86eb-f3751aa6f354@gmail.com>
On Wed, Mar 13, 2024 at 9:33 PM Rubén Justo <rjusto@gmail.com> wrote:
Show 19 quoted lines
> In git-restore we need to free the pathspec and pathspec_from_file
> values from the struct checkout_opts.
>
> A simple fix could be to free them in cmd_restore, after the call to
> checkout_main returns, like we are doing [1][2] in the sibling function
> cmd_checkout.
>
> However, we can do better.
>
> We have git-switch and git-restore, both of them spin-offs[3][4] of
> git-checkout.  All three are implemented as thin wrappers around
> checkout_main.  Considering this, it makes a lot of sense to do the
> cleanup closer to checkout_main.
>
> Factor out the call to checkout_main in a function that does both the
> work and the cleanup, and use it in the three wrappers.
>
> As a consequence, mark: t2070, t2071, t2072 and t6418 as leak-free.
> ---
Missing sign-off.
Previous: Rubén JustoNext: Rubén Justo
Message 2 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.