diff mbox series

[18/21] t/helper: fix leaking buffer in "dump-untracked-cache"

Message ID 71fd1c76b8a9daa338b2669abe0b7fbe19484abf.1728624670.git.ps@pks.im (mailing list archive)
State Superseded
Headers show
Series Memory leak fixes (pt.9) | expand

Commit Message

Patrick Steinhardt Oct. 11, 2024, 5:33 a.m. UTC
We never release the local `struct strbuf base` buffer, thus leaking
memory. Fix this leak.

This leak is exposed by t7063, but plugging it alone does not make the
whole test suite pass.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/helper/test-dump-untracked-cache.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index 4f010d53249..b2e70837a90 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -68,5 +68,7 @@  int cmd__dump_untracked_cache(int ac UNUSED, const char **av UNUSED)
 	printf("flags %08x\n", uc->dir_flags);
 	if (uc->root)
 		dump(uc->root, &base);
+
+	strbuf_release(&base);
 	return 0;
 }