diff options
author | Roland McGrath <roland@gnu.org> | 2002-11-20 09:40:55 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-11-20 09:40:55 +0000 |
commit | 2a652f5aca238f222087271d0fcd525e4c97bb0b (patch) | |
tree | cc06742cf31f2c4b7f009c41ad37ed6870fe6a97 | |
parent | 51b3c8f6b7022ea2351464d174b77dee3505274f (diff) | |
download | glibc-2a652f5aca238f222087271d0fcd525e4c97bb0b.tar.gz glibc-2a652f5aca238f222087271d0fcd525e4c97bb0b.tar.xz glibc-2a652f5aca238f222087271d0fcd525e4c97bb0b.zip |
2002-11-18 Wolfram Gloger <wg@malloc.de>
* malloc/arena.c (ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_unlock_all2): Do nothing if not initialized. Bug report from Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>.
-rw-r--r-- | malloc/arena.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/malloc/arena.c b/malloc/arena.c index 88efbf3ca7..090e3c1dd6 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -73,6 +73,9 @@ static int stat_n_heaps; /* Mapped memory in non-main arenas (reliable only for NO_THREADS). */ static unsigned long arena_mem; +/* Already initialized? */ +int __malloc_initialized = -1; + /**************************************************************************/ #if USE_ARENAS @@ -212,6 +215,8 @@ ptmalloc_lock_all __MALLOC_P((void)) { mstate ar_ptr; + if(__malloc_initialized < 1) + return; (void)mutex_lock(&list_lock); for(ar_ptr = &main_arena;;) { (void)mutex_lock(&ar_ptr->mutex); @@ -232,6 +237,8 @@ ptmalloc_unlock_all __MALLOC_P((void)) { mstate ar_ptr; + if(__malloc_initialized < 1) + return; tsd_setspecific(arena_key, save_arena); __malloc_hook = save_malloc_hook; __free_hook = save_free_hook; @@ -255,6 +262,8 @@ ptmalloc_unlock_all2 __MALLOC_P((void)) { mstate ar_ptr; + if(__malloc_initialized < 1) + return; #if defined _LIBC || defined MALLOC_HOOKS tsd_setspecific(arena_key, save_arena); __malloc_hook = save_malloc_hook; @@ -276,9 +285,6 @@ ptmalloc_unlock_all2 __MALLOC_P((void)) #endif /* !defined NO_THREADS */ -/* Already initialized? */ -int __malloc_initialized = -1; - /* Initialization routine. */ #ifdef _LIBC #include <string.h> |