diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-09-07 16:06:54 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-09-07 16:06:54 +0000 |
commit | 469615bdd422cec2d89a09c765a8e965faa29722 (patch) | |
tree | fa9d9c80c22d4a88d0c0d94e1e9c2cbb982c494c /malloc/malloc.c | |
parent | ba40cc1540f5ee1e2082bd31b0e602a62ea3273f (diff) | |
download | glibc-469615bdd422cec2d89a09c765a8e965faa29722.tar.gz glibc-469615bdd422cec2d89a09c765a8e965faa29722.tar.xz glibc-469615bdd422cec2d89a09c765a8e965faa29722.zip |
[BZ #2775]
* malloc/malloc.c (sYSMALLOc): Only call grow_heap if (long) (MINSIZE + nb - old_size) is positive. * malloc/arena.c (grow_heap): When growing bail even if new_size is negative.
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index 206f3e1b6a..a369001520 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2970,7 +2970,8 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; /* First try to extend the current heap. */ old_heap = heap_for_ptr(old_top); old_heap_size = old_heap->size; - if (grow_heap(old_heap, MINSIZE + nb - old_size) == 0) { + if ((long) (MINSIZE + nb - old_size) > 0 + && grow_heap(old_heap, MINSIZE + nb - old_size) == 0) { av->system_mem += old_heap->size - old_heap_size; arena_mem += old_heap->size - old_heap_size; #if 0 |