From a25d0a8a724da309f6930ba7bbd0b3a6f7cc64aa Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Mon, 9 Nov 2009 14:57:38 -0800 Subject: [PATCH] Update assertions in realloc() and free() to allow for deallocation during initializtion. --- jemalloc/src/jemalloc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jemalloc/src/jemalloc.c b/jemalloc/src/jemalloc.c index f7d69df4..13039a09 100644 --- a/jemalloc/src/jemalloc.c +++ b/jemalloc/src/jemalloc.c @@ -4897,8 +4897,8 @@ malloc_init_hard(void) if (malloc_initialized || malloc_initializer == pthread_self()) { /* * Another thread initialized the allocator before this one - * acquired init_lock, or this thread is the inializing thread, - * and it is recursively allocating. + * acquired init_lock, or this thread is the initializing + * thread, and it is recursively allocating. */ malloc_mutex_unlock(&init_lock); return (false); @@ -5613,7 +5613,8 @@ realloc(void *ptr, size_t size) } if (ptr != NULL) { - assert(malloc_initialized); + assert(malloc_initialized || malloc_initializer == + pthread_self()); ret = iralloc(ptr, size); @@ -5659,7 +5660,8 @@ free(void *ptr) { if (ptr != NULL) { - assert(malloc_initialized); + assert(malloc_initialized || malloc_initializer == + pthread_self()); idalloc(ptr); UTRACE(ptr, 0, 0);