diff options
author | Jeff King <peff@peff.net> | 2023-10-03 22:27:24 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-03 23:28:24 +0200 |
commit | 716a6b2c3a54779e1e6f115a5950511d019f4d17 (patch) | |
tree | 0536ae9ead3e6b9cf8a93faba8274d616a94d45a /t/t6009-rev-list-parent.sh | |
parent | commit-reach: free temporary list in get_octopus_merge_bases() (diff) | |
download | git-716a6b2c3a54779e1e6f115a5950511d019f4d17.tar.xz git-716a6b2c3a54779e1e6f115a5950511d019f4d17.zip |
merge: free result of repo_get_merge_bases()
We call repo_get_merge_bases(), which allocates a commit_list, but never
free the result, causing a leak.
The obvious solution is to free it, but we need to look at the contents
of the first item to decide whether to leave the loop. One option is to
free it in both code paths. But since the commit that the list points to
is longer-lived than the list itself, we can just dereference it
immediately, free the list, and then continue with the existing logic.
This is about the same amount of code, but keeps the list management all
in one place.
This lets us mark a number of merge-related test scripts as leak-free.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6009-rev-list-parent.sh')
-rwxr-xr-x | t/t6009-rev-list-parent.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh index 5a67bbc760..ced40157ed 100755 --- a/t/t6009-rev-list-parent.sh +++ b/t/t6009-rev-list-parent.sh @@ -5,6 +5,7 @@ test_description='ancestor culling and limiting by parent number' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh check_revlist () { |