]> git.ipfire.org Git - thirdparty/git.git/commit - revision.c
revision: clear decoration structs during release_revisions()
authorJeff King <peff@peff.net>
Thu, 5 Oct 2023 21:30:14 +0000 (17:30 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Oct 2023 21:54:57 +0000 (14:54 -0700)
commit8ef8da484272587c5c30810e5fcb03b4048a1221
treec22c4ee43ed93c4ac6ac22f81a7beac87aefe00a
parent771868243cf0b6f7edcec6e672d20faa4e9b50be
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>
line-log.c
line-log.h
revision.c
t/t4217-log-limit.sh