summaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-02-09 22:34:17 -0800
committerUlrich Drepper <drepper@redhat.com>2010-02-09 22:34:17 -0800
commit7eb22e757edecb72754f314c8ffb44350a1dadbc (patch)
treeedf87c5ba4afffb70dc551b1118ff2389cfe0177 /malloc
parent0cbcca89bad6656bfda8c60e143295e0f00054b6 (diff)
downloadglibc-7eb22e757edecb72754f314c8ffb44350a1dadbc.tar.gz
Avoid PLT call to fegetenv on s390
Diffstat (limited to 'malloc')
-rw-r--r--malloc/malloc.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index b43e454f6e..acf1bec500 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-2006, 2007, 2008, 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.
@@ -4850,7 +4850,8 @@ _int_free(mstate av, mchunkptr p)
free_perturb (chunk2mem(p), size - SIZE_SZ);
set_fastchunks(av);
- fb = &fastbin (av, fastbin_index(size));
+ unsigned int idx = fastbin_index(size);
+ fb = &fastbin (av, idx);
#ifdef ATOMIC_FASTBINS
mchunkptr fd;
@@ -4864,6 +4865,12 @@ _int_free(mstate av, mchunkptr p)
errstr = "double free or corruption (fasttop)";
goto errout;
}
+ if (old != NULL && (chunksize(old) > request2size(MAX_FAST_SIZE)
+ || fastbin_index(chunksize(old)) != idx))
+ {
+ errstr = "invalid fastbin entry (free)";
+ goto errout;
+ }
p->fd = fd = old;
}
while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
@@ -4875,6 +4882,12 @@ _int_free(mstate av, mchunkptr p)
errstr = "double free or corruption (fasttop)";
goto errout;
}
+ if (*fb != NULL && (chunksize(*fb) > request2size(MAX_FAST_SIZE)
+ || fastbin_index(chunksize(*fb)) != idx))
+ {
+ errstr = "invalid fastbin entry (free)";
+ goto errout;
+ }
p->fd = *fb;
*fb = p;