read-cache: free threaded memory pool

In load_cache_entries_threaded(), each thread allocates its own memory pool. This pool needs to be cleaned up while closing the threads down, or it will be leaked. This ce_mem_pool pointer could theoretically be converted to an inline copy of the struct, but the use of a pointer helps with existing lazy- initialization logic. Adjusting that behavior only to avoid this pointer would be a much bigger change. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Oct 1, 2024 at 17:37 UTC 5e6f359f6b7829e3baea888f5489f04eebf745af
1 file changed +1
read-cache.c
+1
@@ -2187,6 +2187,7 @@ static unsigned long load_cache_entries_threaded(struct index_state *istate, con
2187 if (err)
2188 die(_("unable to join load_cache_entries thread: %s"), strerror(err));
2189 mem_pool_combine(istate->ce_mem_pool, p->ce_mem_pool);
2190 + free(p->ce_mem_pool);
2191 consumed += p->consumed;
2192 }
2193