aboutsummaryrefslogtreecommitdiff
path: root/malloc/malloc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-31 17:16:11 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-31 17:16:11 +0000
commitb80770b23f7c285fb7c04e3e86dc5f2bb2a1cf11 (patch)
tree3b7b9b7146a0bd23b9111a84a03f7d21bf8cec27 /malloc/malloc.c
parentbee2df0bb966087d7f57d935a4234ffe30c76196 (diff)
downloadglibc-b80770b23f7c285fb7c04e3e86dc5f2bb2a1cf11.zip
glibc-b80770b23f7c285fb7c04e3e86dc5f2bb2a1cf11.tar.gz
glibc-b80770b23f7c285fb7c04e3e86dc5f2bb2a1cf11.tar.bz2
* dlfcn/Makefile (LDLIBS-bug-atexit3-lib.so): Addcvs/fedora-glibc-20060831T1812
ld.so. * malloc/malloc.c (_int_malloc): Use full list insert and not shortcut which assumes the list is empty for large requests too. * elf/tst-addr1.c (do_test): Allow i.dli_sname "_IO_printf".
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r--malloc/malloc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index d37e521..206f3e1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4230,8 +4230,14 @@ _int_malloc(mstate av, size_t bytes)
/* Split */
else {
remainder = chunk_at_offset(victim, nb);
- unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
- remainder->bk = remainder->fd = unsorted_chunks(av);
+ /* We cannot assume the unsorted list is empty and therefore
+ have to perform a complete insert here. */
+ bck = unsorted_chunks(av);
+ fwd = bck->fd;
+ remainder->bk = bck;
+ remainder->fd = fwd;
+ bck->fd = remainder;
+ fwd->bk = remainder;
set_head(victim, nb | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);