Fix a regression in CHUNK_MAP_UNZEROED change.

Fix a regression added by revision:

	3377ffa1f4
	Change CHUNK_MAP_ZEROED to CHUNK_MAP_UNZEROED.

A modified chunk->map dereference was missing the subtraction of
map_bias, which caused incorrect chunk map initialization, as well as
potential corruption of the first non-header page of memory within each
chunk.
This commit is contained in:
Jason Evans 2010-10-14 00:28:31 -07:00
parent ac6f3c2bb5
commit 004ed142a6

View File

@ -457,7 +457,8 @@ arena_chunk_alloc(arena_t *arena)
for (i = map_bias+1; i < chunk_npages-1; i++)
chunk->map[i-map_bias].bits = unzeroed;
}
chunk->map[chunk_npages-1].bits = arena_maxclass | unzeroed;
chunk->map[chunk_npages-1-map_bias].bits = arena_maxclass |
unzeroed;
/* Insert the run into the runs_avail_clean tree. */
arena_avail_tree_insert(&arena->runs_avail_clean,