summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-02-09 14:21:00 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-02-09 14:21:00 -0800
commitc70b5e718749a64eb3a41ecb585bfb85f518878f (patch)
tree9357d8fc7ab58455239d398e497b087f07116f1e /builtin/merge.c
parentMerge branch 'ab/config-based-hooks-2' (diff)
parentmerge: fix memory leaks in cmd_merge() (diff)
downloadtgif-c70b5e718749a64eb3a41ecb585bfb85f518878f.tar.xz
Merge branch 'en/plug-leaks-in-merge'
Leakfix. * en/plug-leaks-in-merge: merge: fix memory leaks in cmd_merge() merge-ort: fix memory leak in merge_ort_internal()
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index fed1ff4017..133831d42f 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1273,7 +1273,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
int best_cnt = -1, merge_was_ok = 0, automerge_was_ok = 0;
struct commit_list *common = NULL;
const char *best_strategy = NULL, *wt_strategy = NULL;
- struct commit_list *remoteheads, *p;
+ struct commit_list *remoteheads = NULL, *p;
void *branch_to_free;
int orig_argc = argc;
@@ -1752,6 +1752,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
ret = suggest_conflicts();
done:
+ if (!automerge_was_ok) {
+ free_commit_list(common);
+ free_commit_list(remoteheads);
+ }
strbuf_release(&buf);
free(branch_to_free);
return ret;