Fix an infinite recursion bug related to a0/tsd bootstrapping.

This resolves #184.
This commit is contained in:
Jason Evans 2015-01-14 16:27:31 -08:00
parent 51f86346c0
commit 24057f3da8

View File

@ -254,7 +254,9 @@ chunk_alloc_default(void *new_addr, size_t size, size_t alignment, bool *zero,
{
arena_t *arena;
arena = arena_get(tsd_fetch(), arena_ind, false, true);
/* Dodge tsd for a0 in order to avoid bootstrapping issues. */
arena = (arena_ind == 0) ? a0get() : arena_get(tsd_fetch(), arena_ind,
false, true);
/*
* The arena we're allocating on behalf of must have been initialized
* already.