about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-10 19:56:41 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-10 19:56:41 +0000
commit3e00177e5a53c83916f8e0edc6d77d8c2a7fdbfb (patch)
treebbb50c2d43dcd9bd30ca863155de31bf3c807f02 /malloc
parent181742f8041aef5adc85da67d96681a32ef9eb00 (diff)
downloadglibc-3e00177e5a53c83916f8e0edc6d77d8c2a7fdbfb.tar.gz
glibc-3e00177e5a53c83916f8e0edc6d77d8c2a7fdbfb.tar.xz
glibc-3e00177e5a53c83916f8e0edc6d77d8c2a7fdbfb.zip
nt_free): Only do arena boundary check for contiguous arenas.
Diffstat (limited to 'malloc')
-rw-r--r--malloc/malloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0d0990cc35..665d7a4b3e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4229,8 +4229,9 @@ _int_free(mstate av, Void_t* mem)
       if (__builtin_expect (p == av->top, 0))
 	goto double_free;
       /* Or whether the next chunk is beyond the boundaries of the arena.  */
-      if (__builtin_expect ((char *) nextchunk >= ((char *) av->top
-						   + chunksize(av->top)), 0))
+      if (__builtin_expect (contiguous (av)
+			    && (char *) nextchunk
+			       >= ((char *) av->top + chunksize(av->top)), 0))
 	goto double_free;
       /* Or whether the block is actually not marked used.  */
       if (__builtin_expect (!prev_inuse(nextchunk), 0))