diff options
author | Andreas Schwab <schwab@redhat.com> | 2010-03-09 15:47:50 +0100 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2010-03-09 15:47:50 +0100 |
commit | 35be409292e2aaab331d21d2bc42ed4c44477281 (patch) | |
tree | df56d1f09cc5c8aca42b2be2af61f775f25a5b23 /malloc/malloc.c | |
parent | 7bea85290bebde69cfb5aa057afb70e019154b4d (diff) | |
parent | 462a5227b0d3220ab68f65272bd5b9d6d4f49b1f (diff) |
Merge remote branch 'origin/master' into fedora/master
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index b43e454f6e..763852ea3b 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1,5 +1,5 @@ /* Malloc implementation for multiple threads without lock contention. - Copyright (C) 1996-2006, 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1996-2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Wolfram Gloger <wg@malloc.de> and Doug Lea <dl@cs.oswego.edu>, 2001. @@ -3933,9 +3933,10 @@ public_vALLOc(size_t bytes) if(!p) { /* Maybe the failure is due to running out of mmapped areas. */ if(ar_ptr != &main_arena) { - (void)mutex_lock(&main_arena.mutex); - p = _int_memalign(&main_arena, pagesz, bytes); - (void)mutex_unlock(&main_arena.mutex); + ar_ptr = &main_arena; + (void)mutex_lock(&ar_ptr->mutex); + p = _int_memalign(ar_ptr, pagesz, bytes); + (void)mutex_unlock(&ar_ptr->mutex); } else { #if USE_ARENAS /* ... or sbrk() has failed and there is still a chance to mmap() */ @@ -3978,9 +3979,10 @@ public_pVALLOc(size_t bytes) if(!p) { /* Maybe the failure is due to running out of mmapped areas. */ if(ar_ptr != &main_arena) { - (void)mutex_lock(&main_arena.mutex); - p = _int_memalign(&main_arena, pagesz, rounded_bytes); - (void)mutex_unlock(&main_arena.mutex); + ar_ptr = &main_arena; + (void)mutex_lock(&ar_ptr->mutex); + p = _int_memalign(ar_ptr, pagesz, rounded_bytes); + (void)mutex_unlock(&ar_ptr->mutex); } else { #if USE_ARENAS /* ... or sbrk() has failed and there is still a chance to mmap() */ |