Skip to content

Commit 220a098

Browse files
committed
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>
1 parent 6258f68 commit 220a098

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

read-cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,7 @@ static unsigned long load_cache_entries_threaded(struct index_state *istate, con
21882188
if (err)
21892189
die(_("unable to join load_cache_entries thread: %s"), strerror(err));
21902190
mem_pool_combine(istate->ce_mem_pool, p->ce_mem_pool);
2191+
free(p->ce_mem_pool);
21912192
consumed += p->consumed;
21922193
}
21932194

0 commit comments

Comments
 (0)