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

Re: [PATCH] merge-ort: clean up after failed merge

From
Elijah Newren <newren@gmail.com>
Date
Jul 29, 2022, 15:31 UTC
Message-ID
<CABPp-BEBVO+O8bJaQRwVpt1VC0dC+sMJduAtmHpYev9uhnF-Rw@mail.gmail.com>
In-Reply-To
<pull.1307.git.1659084748350.gitgitgadget@gmail.com>

On Fri, Jul 29, 2022 at 1:52 AM Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 47 quoted lines
>
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> In 9fefce68dc8 (merge-ort: basic outline for merge_switch_to_result(),
> 2020-12-13), we added functionality to lay down the result of a merge on
> disk. But we forgot to release the data structures in case
> `unpack_trees()` failed to run properly.
>
> This was pointed out by the `linux-leaks` job in our CI runs.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>     merge-ort: clean up after failed merge
>
>     I was investigating why seen's CI runs fail, and came up with this fix.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1307%2Fdscho%2Fmerge-ort-impl-leakfix-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1307/dscho/merge-ort-impl-leakfix-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/1307
>
>  merge-ort.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/merge-ort.c b/merge-ort.c
> index ee7fbe71404..61b9e90018b 100644
> --- a/merge-ort.c
> +++ b/merge-ort.c
> @@ -1002,6 +1002,7 @@ void merge_switch_to_result(struct merge_options *opt,
>                 if (checkout(opt, head, result->tree)) {
>                         /* failure to function */
>                         result->clean = -1;
> +                       merge_finalize(opt, result);
>                         return;
>                 }
>
> @@ -1010,6 +1011,7 @@ void merge_switch_to_result(struct merge_options *opt,
>                                                     &opti->conflicted)) {
>                         /* failure to function */
>                         result->clean = -1;
> +                       merge_finalize(opt, result);
>                         return;
>                 }
>         }
>
> base-commit: 9fefce68dc85d96781090f86c067d83f7c50b617
> --
> gitgitgadget

Good catch. Can you rebase on to a slightly newer commit? I think we also need a trace2_region_leave() call in each block as well, which is only clear if you look at newer versions.

Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 2 of 7 in “merge-ort: clean up after failed merge”
  1. merge-ort: clean up after failed mergeJohannes Schindelin via GitGitGadget, Jul 29, 2022
  2. Elijah NewrenJul 29, 2022
  3. 0/2 merge-ort: clean up after failed mergeJohannes Schindelin via GitGitGadget, Jul 29, 2022
  4. 1/2 merge-ort: clean up after failed mergeJohannes Schindelin via GitGitGadget, Jul 29, 2022
  5. 2/2 merge-ort: do leave Trace2 region even if checkout failsJohannes Schindelin via GitGitGadget, Jul 29, 2022
  6. Elijah NewrenJul 30, 2022
  7. Junio C HamanoJul 31, 2022

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.