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>

Patrick Steinhardt committed Jun 11, 2024 at 11:21 UTC ee6a998583108cebc0db28d70df2aa1b547b6251
9 files changed +16
blame.c
+4
@@ -2928,6 +2928,10 @@ void setup_blame_bloom_data(struct blame_scoreboard *sb)
2928
2929 void cleanup_scoreboard(struct blame_scoreboard *sb)
2930 {
2931 + free(sb->lineno);
2932 + clear_prio_queue(&sb->commits);
2933 + oidset_clear(&sb->ignore_list);
2934 +
2935 if (sb->bloom_data) {
2936 int i;
2937 for (i = 0; i < sb->bloom_data->nr; i++) {
t/t4061-diff-indent.sh
+1
@@ -6,6 +6,7 @@ test_description='Test diff indent heuristic.
6 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
7 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8
9 +TEST_PASSES_SANITIZE_LEAK=true
10 . ./test-lib.sh
11 . "$TEST_DIRECTORY"/lib-diff.sh
12
t/t8002-blame.sh
+1
@@ -5,6 +5,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7 TEST_CREATE_REPO_NO_TEMPLATE=1
8 +TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10
11 PROG='git blame -c'
t/t8004-blame-with-conflicts.sh
+1
@@ -6,6 +6,7 @@ test_description='git blame on conflicted files'
6 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
7 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8
9 +TEST_PASSES_SANITIZE_LEAK=true
10 . ./test-lib.sh
11
12 test_expect_success 'setup first case' '
t/t8006-blame-textconv.sh
+2
@@ -1,6 +1,8 @@
1 #!/bin/sh
2
3 test_description='git blame textconv support'
4 +
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 find_blame() {
t/t8009-blame-vs-topicbranches.sh
+2
@@ -1,6 +1,8 @@
1 #!/bin/sh
2
3 test_description='blaming trough history with topic branches'
4 +
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 # Creates the history shown below. '*'s mark the first parent in the merges.
t/t8011-blame-split-file.sh
+2
@@ -10,6 +10,8 @@ Note that we need to use "blame -C" to find the commit for all lines. We will
10 not bother testing that the non-C case fails to find it. That is how blame
11 behaves now, but it is not a property we want to make sure is retained.
12 '
13 +
14 +TEST_PASSES_SANITIZE_LEAK=true
15 . ./test-lib.sh
16
17 # help avoid typing and reading long strings of similar lines
t/t8012-blame-colors.sh
+1
@@ -5,6 +5,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7 TEST_CREATE_REPO_NO_TEMPLATE=1
8 +TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10
11 PROG='git blame -c'
t/t8014-blame-ignore-fuzzy.sh
+2
@@ -1,6 +1,8 @@
1 #!/bin/sh
2
3 test_description='git blame ignore fuzzy heuristic'
4 +
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 pick_author='s/^[0-9a-f^]* *(\([^ ]*\) .*/\1/'