]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule--helper: fix "errmsg_str" memory leak
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 31 Aug 2022 23:14:14 +0000 (01:14 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Sep 2022 16:18:12 +0000 (09:18 -0700)
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>
builtin/submodule--helper.c

index 65cd25a25119137d2bf0aa9b5e5086f4434f7197..c95098e62155816afbb58af9e27802964ba967d7 100644 (file)
@@ -973,6 +973,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,