]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-reach: fix trivial memory leak when computing reachability
authorPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2024 10:41:15 +0000 (12:41 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Aug 2024 15:47:38 +0000 (08:47 -0700)
We don't free the local `stack` commit list that we use to compute
reachability of multiple commits at once. Do so.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-reach.c
t/t3201-branch-contains.sh

index dabc2972e423bcf5899fc31935d39a599ffec9aa..02f8218b8e192bdf63f4067f7f4430ad14c0abb8 100644 (file)
@@ -1227,4 +1227,5 @@ void tips_reachable_from_bases(struct repository *r,
 done:
        free(commits);
        repo_clear_commit_marks(r, SEEN);
+       free_commit_list(stack);
 }
index 800fc33165a9eff0abe1f6edc27acb2b4978e317..6e587d27d7a5e3867d27d05d300f7e8149e77587 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='branch --contains <commit>, --no-contains <commit> --merged, and --no-merged'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '