mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
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 1c7b76be7d
(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>
This commit is contained in:
parent
272f0a574d
commit
465028e0e2
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ test_description='git merge
|
|||
|
||||
Testing merge when using a custom message for the merge commit.'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
create_merge_msgs() {
|
||||
|
|
Loading…
Reference in a new issue