submodule--helper: fix "errmsg_str" memory leak

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> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 1, 2022 at 01:14 UTC 61adac6c4b5839ffcc8b0f7081acac4a18240644
1 file changed +1
builtin/submodule--helper.c
+1
@@ -973,6 +973,7 @@ static void generate_submodule_summary(struct summary_cb *info,
973 free(displaypath);
974 free(src_abbrev);
975 free(dst_abbrev);
976 + strbuf_release(&errmsg);
977 }
978
979 static void prepare_submodule_summary(struct summary_cb *info,