diff options
author | Jeff King <peff@peff.net> | 2023-10-06 00:30:14 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-06 00:54:57 +0300 |
commit | 8ef8da484272587c5c30810e5fcb03b4048a1221 (patch) | |
tree | c22c4ee43ed93c4ac6ac22f81a7beac87aefe00a /line-log.h | |
parent | 771868243cf0b6f7edcec6e672d20faa4e9b50be (diff) |
revision: clear decoration structs during release_revisions()
The point of release_revisions() is to free memory associated with the
rev_info struct, but we have several "struct decoration" members that
are left untouched. Since the previous commit introduced a function to
do that, we can just call it.
We do have to provide some specialized callbacks to map the void
pointers onto real ones (the alternative would be casting the existing
function pointers; this generally works because "void *" is usually
interchangeable with a struct pointer, but it is technically forbidden
by the standard).
Since the line-log code does not expose the type it stores in the
decoration (nor of course the function to free it), I put this behind a
generic line_log_free() entry point. It's possible we may need to add
more line-log specific bits anyway (running t4211 shows a number of
other leaks in the line-log code).
While this doubtless cleans up many leaks triggered by the test suite,
the only script which becomes leak-free is t4217, as it does very little
beyond a simple traversal (its existing leak was from the use of
--children, which is now fixed).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'line-log.h')
-rw-r--r-- | line-log.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/line-log.h b/line-log.h index adff361b1b..4291da8d79 100644 --- a/line-log.h +++ b/line-log.h @@ -60,4 +60,6 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, int line_log_print(struct rev_info *rev, struct commit *commit); +void line_log_free(struct rev_info *rev); + #endif /* LINE_LOG_H */ |