about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-11-14 11:41:52 +0100
committerAndreas Schwab <schwab@redhat.com>2011-11-14 11:53:46 +0100
commita5fb313cb7b7e692fd4684916aaa98e03ec7e8b6 (patch)
tree2f141ca62172323cde414acde9a10add23adfdb5 /malloc
parent7edb22eff50b957c5b40815d0974639db19f5870 (diff)
downloadglibc-a5fb313cb7b7e692fd4684916aaa98e03ec7e8b6.tar.gz
glibc-a5fb313cb7b7e692fd4684916aaa98e03ec7e8b6.tar.xz
glibc-a5fb313cb7b7e692fd4684916aaa98e03ec7e8b6.zip
Don't call reused_arena when _int_new_arena failed
Diffstat (limited to 'malloc')
-rw-r--r--malloc/arena.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/malloc/arena.c b/malloc/arena.c
index 042cac85c0..cb8548ba3f 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -844,14 +844,14 @@ arena_get2(mstate a_tsd, size_t size)
       size_t n = narenas;
       if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
 	{
-	  if (catomic_compare_and_exchange_bool_acq(&narenas, n + 1, n))
+	  if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
 	    goto repeat;
 	  a = _int_new_arena (size);
-	  if (__builtin_expect (a != NULL, 1))
-	    return a;
-	  catomic_decrement(&narenas);
+	  if (__builtin_expect (a == NULL, 0))
+	    catomic_decrement (&narenas);
 	}
-      a = reused_arena ();
+      else
+	a = reused_arena ();
     }
 #else
   if(!a_tsd)