summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-11-20 14:39:37 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-21 00:23:42 +0100
commit141766d1bb801ae2a9c7358920ce8dc9697f53c4 (patch)
tree0d8c3bfc70bebdf1cfcd5ff7a2483702c4f8174b /t
parentbisect: fix various cases where we leak commit list items (diff)
downloadgit-141766d1bb801ae2a9c7358920ce8dc9697f53c4.tar.xz
git-141766d1bb801ae2a9c7358920ce8dc9697f53c4.zip
line-log: fix leak when rewriting commit parents
In `process_ranges_merge_commit()` we try to figure out which of the parents can be blamed for the given line changes. When we figure out that none of the files in the line-log have changed we assign the complete blame to that commit and rewrite the parents of the current commit to only use that single parent. This is done via `commit_list_append()`, which is misleadingly _not_ appending to the list of parents. Instead, we overwrite the parents with the blamed parent. This makes us lose track of the old pointers, creating a memory leak. Fix this issue by freeing the parents before we overwrite them. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4211-line-log.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index 950451cf6a..1d6dd982a2 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -4,6 +4,7 @@ test_description='test log -L'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup (import history)' '