blame: fix leaking data for blame scoreboards

There are some memory leaks when cleaning up blame scoreboards. Fix
those.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-06-11 11:21:20 +02:00
committed by Junio C Hamano
parent 4b4f5a911c
commit ee6a998583
9 changed files with 16 additions and 0 deletions

View File

@ -2928,6 +2928,10 @@ void setup_blame_bloom_data(struct blame_scoreboard *sb)
void cleanup_scoreboard(struct blame_scoreboard *sb)
{
free(sb->lineno);
clear_prio_queue(&sb->commits);
oidset_clear(&sb->ignore_list);
if (sb->bloom_data) {
int i;
for (i = 0; i < sb->bloom_data->nr; i++) {

View File

@ -6,6 +6,7 @@ test_description='Test diff indent heuristic.
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-diff.sh

View File

@ -5,6 +5,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
PROG='git blame -c'

View File

@ -6,6 +6,7 @@ test_description='git blame on conflicted files'
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 first case' '

View File

@ -1,6 +1,8 @@
#!/bin/sh
test_description='git blame textconv support'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
find_blame() {

View File

@ -1,6 +1,8 @@
#!/bin/sh
test_description='blaming trough history with topic branches'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Creates the history shown below. '*'s mark the first parent in the merges.

View File

@ -10,6 +10,8 @@ Note that we need to use "blame -C" to find the commit for all lines. We will
not bother testing that the non-C case fails to find it. That is how blame
behaves now, but it is not a property we want to make sure is retained.
'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# help avoid typing and reading long strings of similar lines

View File

@ -5,6 +5,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
PROG='git blame -c'

View File

@ -1,6 +1,8 @@
#!/bin/sh
test_description='git blame ignore fuzzy heuristic'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pick_author='s/^[0-9a-f^]* *(\([^ ]*\) .*/\1/'