Skip to content

Commit bf1b32d

Browse files
avargitster
authored andcommitted
revisions API users: use release_revisions() with UNLEAK()
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f6bfea0 commit bf1b32d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

builtin/diff-index.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
7171
}
7272
result = run_diff_index(&rev, option);
7373
UNLEAK(rev);
74-
return diff_result_code(&rev.diffopt, result);
74+
result = diff_result_code(&rev.diffopt, result);
75+
release_revisions(&rev);
76+
return result;
7577
}

builtin/diff.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
595595
if (1 < rev.diffopt.skip_stat_unmatch)
596596
refresh_index_quietly();
597597
UNLEAK(rev);
598+
release_revisions(&rev);
598599
UNLEAK(ent);
599600
UNLEAK(blob);
600601
return result;

0 commit comments

Comments
 (0)