]> Kevux Git Server - rit/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 85fb23d..642a0ed 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 f3fff55..1358236 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 '