builtin/fmt-merge-msg: fix leaking buffers

Fix leaking input and output buffers in git-fmt-merge-msg(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-09-05 12:09:34 +02:00 committed by Junio C Hamano
parent ee087c29c8
commit 68bd0a94be
2 changed files with 3 additions and 0 deletions

View File

@ -67,6 +67,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
return ret;
write_in_full(STDOUT_FILENO, output.buf, output.len);
strbuf_release(&input);
strbuf_release(&output);
free(inpath);
return 0;
}

View File

@ -8,6 +8,7 @@ test_description='fmt-merge-msg test'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"