Skip to content

Commit bb8c43d

Browse files
pks-tgitster
authored andcommitted
notes-utils: free note trees when releasing copied notes
While we clear most of the members of `struct notes_rewrite_cfg` in `finish_copy_notes_for_rewrite()`, we do not clear the notes tree. Fix this to plug this memory leak. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 14da262 commit bb8c43d

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

notes-utils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ void finish_copy_notes_for_rewrite(struct repository *r,
187187
for (i = 0; c->trees[i]; i++) {
188188
commit_notes(r, c->trees[i], msg);
189189
free_notes(c->trees[i]);
190+
free(c->trees[i]);
190191
}
191192
free(c->trees);
192193
free(c);

t/t3400-rebase.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ among other things.
1111
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
1212
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1313

14+
TEST_PASSES_SANITIZE_LEAK=true
1415
. ./test-lib.sh
1516

1617
GIT_AUTHOR_NAME=author@name

t/t7501-commit-basic-functionality.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ test_description='git commit'
99
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
1010
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1111

12+
TEST_PASSES_SANITIZE_LEAK=true
1213
. ./test-lib.sh
1314
. "$TEST_DIRECTORY/lib-diff.sh"
1415

0 commit comments

Comments
 (0)