@@ -70,7 +70,6 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
return -1;
}
result = run_diff_index(&rev, option);
- UNLEAK(rev);
result = diff_result_code(&rev.diffopt, result);
release_revisions(&rev);
return result;
@@ -594,7 +594,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
result = diff_result_code(&rev.diffopt, result);
if (1 < rev.diffopt.skip_stat_unmatch)
refresh_index_quietly();
- UNLEAK(rev);
release_revisions(&rev);
UNLEAK(ent);
UNLEAK(blob);
@@ -2956,6 +2956,8 @@ void release_revisions(struct rev_info *revs)
clear_pathspec(&revs->prune_data);
release_revisions_mailmap(revs->mailmap);
free_grep_patterns(&revs->grep_filter);
+ /* TODO (need to handle "no_free"): diff_free(&revs->diffopt) */
+ diff_free(&revs->pruning);
reflog_walk_info_release(revs->reflog_info);
}
@@ -2,6 +2,7 @@
test_description='git checkout --patch'
+TEST_PASSES_SANITIZE_LEAK=true
. ./lib-patch-mode.sh
test_expect_success PERL 'setup' '
@@ -2,6 +2,7 @@
test_description='diff with assume-unchanged entries'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# external diff has been tested in t4020-diff-external.sh
@@ -6,6 +6,8 @@
test_description='Test --follow should always find copies hard in git log.
'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='test case insensitive pathspec limiting'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if test_have_prereq CASE_INSENSITIVE_FS
Call diff_free() on the "pruning" member of "struct rev_info". We'll handle the "diffopt" member of the same type some other time, doing so will require us to untangle the "no_free" conditions I added in e900d494dcf (diff: add an API for deferred freeing, 2021-02-11). Even without "diffopt" addressing leaks in "pruning" makes several tests pass under SANITIZE=leak. This was also the last missing piece that allows us to remove the UNLEAK() in "cmd_diff" and "cmd_diff_index", which allows us to use those commands as a canary for general leaks in the revisions API. See [1] for further rationale, and 886e1084d78 (builtin/: add UNLEAKs, 2017-10-01) for the commit that added the UNLEAK() there. 1. https://lore.kernel.org/git/220218.861r00ib86.gmgdl@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/diff-index.c | 1 - builtin/diff.c | 1 - revision.c | 2 ++ t/t2016-checkout-patch.sh | 1 + t/t4039-diff-assume-unchanged.sh | 1 + t/t4206-log-follow-harder-copies.sh | 2 ++ t/t6131-pathspec-icase.sh | 2 ++ 7 files changed, 8 insertions(+), 2 deletions(-)