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/t4052-stat-output.sh | 1 + 2 files changed, 2 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/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.1451.g86b35f4140a