diff options
author | Andreas Schwab <schwab@redhat.com> | 2010-05-19 13:03:56 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2010-05-19 13:03:56 +0200 |
commit | 181c13586f12a9a15ed446b1a9594a5a8831d8d1 (patch) | |
tree | 52c4786d2d0448e9cbe9f4d25fadc7e7cee52924 /malloc/malloc.c | |
parent | 9100611515956d730bac91fe23976978b0ab70a6 (diff) | |
parent | 4828935d386854c19275dbe39e07dbd4bd539d1c (diff) | |
download | glibc-181c13586f12a9a15ed446b1a9594a5a8831d8d1.tar.gz glibc-181c13586f12a9a15ed446b1a9594a5a8831d8d1.tar.xz glibc-181c13586f12a9a15ed446b1a9594a5a8831d8d1.zip |
Merge remote branch 'origin/master' into fedora/master
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index 722b1d4961..9594be4cbd 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -4859,6 +4859,7 @@ _int_free(mstate av, mchunkptr p) #ifdef ATOMIC_FASTBINS mchunkptr fd; mchunkptr old = *fb; + unsigned int old_idx = ~0u; do { /* Another simple check: make sure the top of the bin is not the @@ -4868,15 +4869,17 @@ _int_free(mstate av, mchunkptr p) errstr = "double free or corruption (fasttop)"; goto errout; } - if (old != NULL - && __builtin_expect (fastbin_index(chunksize(old)) != idx, 0)) - { - errstr = "invalid fastbin entry (free)"; - goto errout; - } + if (old != NULL) + old_idx = fastbin_index(chunksize(old)); p->fd = fd = old; } while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd); + + if (fd != NULL && __builtin_expect (old_idx != idx, 0)) + { + errstr = "invalid fastbin entry (free)"; + goto errout; + } #else /* Another simple check: make sure the top of the bin is not the record we are going to add (i.e., double free). */ |