diff options
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index 058c156be4..3d4933cd7c 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1522,7 +1522,7 @@ static unsigned long max_mmapped_mem = 0; #endif /* Already initialized? */ -int __malloc_initialized = 0; +int __malloc_initialized = -1; /* The following two functions are registered via thread_atfork() to @@ -1596,8 +1596,8 @@ ptmalloc_init __MALLOC_P((void)) const char* s; #endif - if(__malloc_initialized) return; - __malloc_initialized = 1; + if(__malloc_initialized >= 0) return; + __malloc_initialized = 0; #if defined _LIBC || defined MALLOC_HOOKS /* With some threads implementations, creating thread-specific data or initializing a mutex may call malloc() itself. Provide a @@ -1638,6 +1638,7 @@ ptmalloc_init __MALLOC_P((void)) if(__malloc_initialize_hook != NULL) (*__malloc_initialize_hook)(); #endif + __malloc_initialized = 1; } /* There are platforms (e.g. Hurd) with a link-time hook mechanism. */ |