]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge-ort: clean up after failed merge
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 29 Jul 2022 17:12:06 +0000 (17:12 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2022 02:24:13 +0000 (19:24 -0700)
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>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c

index c319797021938a9df635c8db146ac6555331c7db..52deb36594a4d7fa97facf1eb43e4342569de138 100644 (file)
@@ -4225,6 +4225,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;
                }
                trace2_region_leave("merge", "checkout", opt->repo);
@@ -4235,6 +4236,7 @@ void merge_switch_to_result(struct merge_options *opt,
                        /* failure to function */
                        opt->priv = NULL;
                        result->clean = -1;
+                       merge_finalize(opt, result);
                        return;
                }
                opt->priv = NULL;