commit-reach: fix trivial memory leak when computing reachability

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>

Patrick Steinhardt committed Aug 1, 2024 at 12:41 UTC f30bfafcd41d0f13575361957dc361aa2be4d4c5
2 files changed +2
commit-reach.c
+1
@@ -1227,4 +1227,5 @@ void tips_reachable_from_bases(struct repository *r,
1227 done:
1228 free(commits);
1229 repo_clear_commit_marks(r, SEEN);
1230 + free_commit_list(stack);
1231 }
t/t3201-branch-contains.sh
+1
@@ -2,6 +2,7 @@
2
3 test_description='branch --contains <commit>, --no-contains <commit> --merged, and --no-merged'
4
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success setup '