@matheusbsbs / matheus-bagliano / commits / bcd2c5eede
Fork 0

read-cache: fix mem-pool allocation for multi-threaded index loading

44c7e1a7e0 (mem-pool: use more standard initialization and finalization, 2020-08-15) moved the allocation of the mem-pool structure to callers. It also added an allocation to load_cache_entries_threaded(), but for an unrelated mem-pool. Fix that by allocating the correct one instead -- the one that is initialized two lines later. Reported-by: Sandor Bodo-Merle <sbodomerle@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Sep 4, 2020 at 19:33 UTC bcd2c5eedecf473fa6b15ebda798ce54bb3c75ea
1 file changed +1 -1
read-cache.c
+1 -1
@@ -2101,7 +2101,7 @@ static unsigned long load_cache_entries_threaded(struct index_state *istate, con
2101 nr = 0;
2102 for (j = p->ieot_start; j < p->ieot_start + p->ieot_blocks; j++)
2103 nr += p->ieot->entries[j].nr;
2104 - istate->ce_mem_pool = xmalloc(sizeof(*istate->ce_mem_pool));
2104 + p->ce_mem_pool = xmalloc(sizeof(*istate->ce_mem_pool));
2105 if (istate->version == 4) {
2106 mem_pool_init(p->ce_mem_pool,
2107 estimate_cache_size_from_compressed(nr));