]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/submodule--helper: fix leaking refs on push-check
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Sep 2024 10:08:56 +0000 (12:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2024 15:49:11 +0000 (08:49 -0700)
In the push-check subcommand of the submodule helper we acquire a list
of local refs, but never free that list. Fix this memory leak.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
t/t5531-deep-submodule-push.sh

index 85fb23dee84c18b850ee21ff269910d3ed426c7d..642a0edabf0468e4c1b1b14c30f4cd4eeb75b3b2 100644 (file)
@@ -2958,7 +2958,9 @@ static int push_check(int argc, const char **argv, const char *prefix UNUSED)
                                    rs->src);
                        }
                }
+
                refspec_clear(&refspec);
+               free_refs(local_refs);
        }
        free(head);
 
index f3fff557447c3e2e5c46878e7f0415c38d29e970..135823630a37c69bd17e0bc7ed8c1e94233dd653 100755 (executable)
@@ -8,6 +8,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
 export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '