summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-07 12:01:37 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-07 15:40:16 -0700
commit465028e0e25518bfff8b83057775cb6b2df2aade (patch)
treeb8b76f7f93aa796181190a543f01c71064015f41 /builtin
parentls-files: add missing string_list_clear() (diff)
downloadtgif-465028e0e25518bfff8b83057775cb6b2df2aade.tar.xz
merge: add missing strbuf_release()
We strbuf_reset() this "struct strbuf" in a loop earlier, but never freed it. Plugs a memory leak that's been here ever since this code got introduced in 1c7b76be7d6 (Build in merge, 2008-07-07). This takes us from 68 failed tests in "t7600-merge.sh" to 59 under SANITIZE=leak, and makes "t7604-merge-custom-message.sh" pass! Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/merge.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 3fbdacc7db..e52f308a1a 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1576,6 +1576,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
finish(head_commit, remoteheads, &commit->object.oid, msg.buf);
remove_merge_branch_state(the_repository);
+ strbuf_release(&msg);
goto done;
} else if (!remoteheads->next && common->next)
;
@@ -1746,6 +1747,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
ret = suggest_conflicts();
done:
+ strbuf_release(&buf);
free(branch_to_free);
return ret;
}