Message ID | pull.1518.v2.git.1682194930766.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 000c4ceca794645eb4744f9c9afb6247232c0646 |
Headers | show |
Series | [v2] merge-ort: fix calling merge_finalize() with no intermediate merge | expand |
On 4/22/2023 4:22 PM, Elijah Newren via GitGitGadget wrote: > merge-ort: fix calling merge_finalize() with no intermediate merge > > Changes since v1: > > * Moved code into an if-block instead of returning early, as suggested > by Stolee. v2 LGTM. Thanks! -Stolee
diff --git a/merge-ort.c b/merge-ort.c index 5bf64354d16..29966fc082f 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -4718,14 +4718,14 @@ void merge_switch_to_result(struct merge_options *opt, void merge_finalize(struct merge_options *opt, struct merge_result *result) { - struct merge_options_internal *opti = result->priv; - if (opt->renormalize) git_attr_set_direction(GIT_ATTR_CHECKIN); assert(opt->priv == NULL); - clear_or_reinit_internal_opts(opti, 0); - FREE_AND_NULL(opti); + if (result->priv) { + clear_or_reinit_internal_opts(result->priv, 0); + FREE_AND_NULL(result->priv); + } } /*** Function Grouping: helper functions for merge_incore_*() ***/