Call graph_clear() in release_revisions(), this will free memory allocated by e.g. this command, which will now run without memory leaks: git -P log -1 --graph --no-graph --graph Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- revision.c | 1 + t/t3413-rebase-hook.sh | 1 + t/t4052-stat-output.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/revision.c b/revision.c index 0760e78936e..650dd17599a 100644 --- a/revision.c +++ b/revision.c @@ -3020,6 +3020,7 @@ void release_revisions(struct rev_info *revs) date_mode_release(&revs->date_mode); release_revisions_mailmap(revs->mailmap); free_grep_patterns(&revs->grep_filter); + graph_clear(revs->graph); /* TODO (need to handle "no_free"): diff_free(&revs->diffopt) */ diff_free(&revs->pruning); reflog_walk_info_release(revs->reflog_info); diff --git a/t/t3413-rebase-hook.sh b/t/t3413-rebase-hook.sh index 9fab0d779bb..e8456831e8b 100755 --- a/t/t3413-rebase-hook.sh +++ b/t/t3413-rebase-hook.sh @@ -5,6 +5,7 @@ test_description='git rebase with its hook(s)' 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 ' diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index b5c281edaa7..3ee27e277dc 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -8,6 +8,7 @@ test_description='test --stat output of various commands' 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-terminal.sh -- 2.38.0.1467.g709fbdff1a9