diff mbox series

[v4,07/17] submodule--helper: fix "errmsg_str" memory leak

Message ID patch-v4-07.17-d4c81e04254-20220728T162442Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit 61adac6c4b5839ffcc8b0f7081acac4a18240644
Headers show
Series submodule--helper: (only) fix memory leaks | expand

Commit Message

Ævar Arnfjörð Bjarmason July 28, 2022, 4:30 p.m. UTC
Fix a memory leak introduced in e83e3333b57 (submodule: port submodule
subcommand 'summary' from shell to C, 2020-08-13), we sometimes append
to the "errmsg", and need to free the "struct strbuf".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/submodule--helper.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 48507a6e0df..5cbe6a41e5f 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -960,6 +960,7 @@  static void generate_submodule_summary(struct summary_cb *info,
 	free(displaypath);
 	free(src_abbrev);
 	free(dst_abbrev);
+	strbuf_release(&errmsg);
 }
 
 static void prepare_submodule_summary(struct summary_cb *info,