]> git.ipfire.org Git - thirdparty/git.git/commit
submodule--helper: fix "sm_path" and other "module_cb_list" leaks
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 31 Aug 2022 23:14:15 +0000 (01:14 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Sep 2022 16:18:12 +0000 (09:18 -0700)
commit980416e469ad2ed0d38630cf4c25390ae9731416
tree977f0ffcfb7055d6d8f0f0a22a0de45fe6181015
parent61adac6c4b5839ffcc8b0f7081acac4a18240644
submodule--helper: fix "sm_path" and other "module_cb_list" leaks

Fix leaks in "struct module_cb_list" and the "struct module_cb" which
it contains, these fix leaks in e83e3333b57 (submodule: port submodule
subcommand 'summary' from shell to C, 2020-08-13).

The "sm_path" should always have been a "char *", not a "const
char *", we always create it with xstrdup().

We can't mark any tests passing passing with SANITIZE=leak using
"TEST_PASSES_SANITIZE_LEAK=true" as a result of this change, but
"t7401-submodule-summary.sh" gets closer to passing as a result of
this change.

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
t/t7401-submodule-summary.sh