Re: [PATCH 1/3] bloom: make bloom-filter slab initialization idempotent
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Jul 1, 2026, 13:53 UTC
- Message-ID
- <f7384ae3-bcd3-4191-9ff9-1ab86701c762@gmail.com>
- In-Reply-To
- <20260701063942.GA2580331@coredump.intra.peff.net>
On 7/1/2026 2:39 AM, Jeff King wrote:
Show 5 quoted lines
> Before using any of the commit-graph bloom-filter code, somebody needs > to call init_bloom_filters(). This initializes the commit-slab we use > for storing filter information. But we don't want to call it twice > (without a matching deinit call in the middle), since it overwrites the > existing slab pointers, leaking the old values.
...
> This patch takes a smaller and more direct route to just dealing with > the potential leak issue.
> +static int bloom_filter_slab_initialized;
Show 7 quoted lines
> void init_bloom_filters(void)
> {
> + if (bloom_filter_slab_initialized)
> + return;
> init_bloom_filter_slab(&bloom_filters);
> + bloom_filter_slab_initialized = 1;
> }> {
> deep_clear_bloom_filter_slab(&bloom_filters, free_one_bloom_filter);
> + bloom_filter_slab_initialized = 0;
> }This patch looks like the right fix.
Thanks, -Stolee