From bf1b32d0991cfead7e5604897d0866b789bf602e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 13 Apr 2022 22:01:43 +0200 Subject: revisions API users: use release_revisions() with UNLEAK() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a release_revisions() with those "struct rev_list" users which already "UNLEAK" the struct. It may seem odd to simultaneously attempt to free() memory, but also to explicitly ignore whether we have memory leaks in the same. As explained in preceding commits this is being done to use the built-in commands as a guinea pig for whether the release_revisions() function works as expected, we'd like to test e.g. whether we segfault as we change it. In subsequent commits we'll then remove these UNLEAK() as the function is made to free the memory that caused us to add them in the first place. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- builtin/diff-index.c | 4 +++- builtin/diff.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/builtin/diff-index.c b/builtin/diff-index.c index 5fd23ab5b6..3a83183c31 100644 --- a/builtin/diff-index.c +++ b/builtin/diff-index.c @@ -71,5 +71,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix) } result = run_diff_index(&rev, option); UNLEAK(rev); - return diff_result_code(&rev.diffopt, result); + result = diff_result_code(&rev.diffopt, result); + release_revisions(&rev); + return result; } diff --git a/builtin/diff.c b/builtin/diff.c index bb7fafca61..dd48336da5 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -595,6 +595,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix) if (1 < rev.diffopt.skip_stat_unmatch) refresh_index_quietly(); UNLEAK(rev); + release_revisions(&rev); UNLEAK(ent); UNLEAK(blob); return result; -- cgit v1.2.1