Re: [PATCH 2/3] revision: avoid leaking bloom keyvecs with multiple traversals
From: Junio C Hamano <hidden>
Date: 2026-07-01 15:52:51
Jeff King [off-list ref] writes:
I think it would _probably_ work in practice, since any caller using a rev_info for multiple traversals is probably doing so with the same pathspec. But it would also create a very subtle bug if that assumption is violated. So we'll do the safer thing here, and generate fresh keyvec entries for each traversal. The efficiency difference is probably not noticeable, and this is what was happening already (we just weren't bothering to free the old ones!).
Good to see the thinking behind the design recorded so clearly in the log message. That thinking being on the more conservative side is a big plus.
quoted hunk ↗ jump to hunk
Signed-off-by: Jeff King <redacted> --- revision.c | 2 ++ 1 file changed, 2 insertions(+)diff --git a/revision.c b/revision.c index e91d7e1f11..0ef9d895f0 100644 --- a/revision.c +++ b/revision.c@@ -707,6 +707,8 @@ static int convert_pathspec_to_bloom_keyvec(struct bloom_keyvec **out, static void prepare_to_use_bloom_filter(struct rev_info *revs) { + release_revisions_bloom_keyvecs(revs); + if (!revs->commits) return;