From: Patrick Steinhardt Date: Thu, 26 Sep 2024 11:46:14 +0000 (+0200) Subject: builtin/submodule--helper: fix leaking error buffer X-Git-Tag: v2.47.0-rc1~3^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2266bb4f6a8a876b57eaa04dc93f7b567e0e4eed;p=thirdparty%2Fgit.git builtin/submodule--helper: fix leaking error buffer Fix leaking error buffer when `compute_alternate_path()` fails. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index fd1b679408..ff1376f69f 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1621,6 +1621,8 @@ static int add_possible_reference_from_superproject( ; /* nothing */ } } + + strbuf_release(&err); strbuf_release(&sb); } diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh index d6040e0a33..7e1afa9ce4 100755 --- a/t/t7408-submodule-reference.sh +++ b/t/t7408-submodule-reference.sh @@ -4,6 +4,8 @@ # test_description='test clone --reference' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh base_dir=$(pwd)