]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/helper: fix leaking subrepo in nested submodule config helper
authorPatrick Steinhardt <ps@pks.im>
Thu, 26 Sep 2024 11:46:18 +0000 (13:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Sep 2024 15:25:35 +0000 (08:25 -0700)
In the "submodule-nested-repo-config" helper we create a submodule
repository and print its configuration. We do not clear the repo,
causing a memory leak. Plug it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-submodule-nested-repo-config.c
t/t7411-submodule-config.sh

index 6ca069ce63370de9977c5b653d0e5b6abd26fba9..6dce957153112a35dcd9f9f493cb8d01249626ab 100644 (file)
@@ -29,6 +29,6 @@ int cmd__submodule_nested_repo_config(int argc, const char **argv)
        print_config_from_gitmodules(&subrepo, argv[2]);
 
        submodule_free(the_repository);
-
+       repo_clear(&subrepo);
        return 0;
 }
index 31271f8e0a61f7b071c770f9efad0e235920f37f..af0de496e07470df03e9dada0247daf8d53850f0 100755 (executable)
@@ -10,6 +10,7 @@ from the database and from the worktree works.
 '
 
 TEST_NO_CREATE_REPO=1
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '