diff options
author | Jeff King <peff@peff.net> | 2023-10-03 23:27:24 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-04 00:28:24 +0300 |
commit | 716a6b2c3a54779e1e6f115a5950511d019f4d17 (patch) | |
tree | 0536ae9ead3e6b9cf8a93faba8274d616a94d45a /t/t6416-recursive-corner-cases.sh | |
parent | ec97ad120caad0c7366a19a6680d37e2b8c5107c (diff) |
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/t6416-recursive-corner-cases.sh')
-rwxr-xr-x | t/t6416-recursive-corner-cases.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t6416-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh index 17b54d625d..5f414abc89 100755 --- a/t/t6416-recursive-corner-cases.sh +++ b/t/t6416-recursive-corner-cases.sh @@ -5,6 +5,7 @@ test_description='recursive merge corner cases involving criss-cross merges' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-merge.sh |