From 6494060312de389feb65ad32bb411fcc64e821b7 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 11 Oct 2008 08:52:58 +0000 Subject: Fix bug 4994 hangs on read(). I have tested the patch extensibly on ARM/LT.old. Thank you Chase Douglas for reporting it and for the patch. --- libc/stdlib/malloc/heap_free.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libc/stdlib/malloc/heap_free.c') diff --git a/libc/stdlib/malloc/heap_free.c b/libc/stdlib/malloc/heap_free.c index 1c4634c55..3326bc691 100644 --- a/libc/stdlib/malloc/heap_free.c +++ b/libc/stdlib/malloc/heap_free.c @@ -18,7 +18,7 @@ /* Return the block of memory at MEM, of size SIZE, to HEAP. */ struct heap_free_area * -__heap_free (struct heap *heap, void *mem, size_t size) +__heap_free (struct heap_free_area *heap, void *mem, size_t size) { struct heap_free_area *fa, *prev_fa; void *end = (char *)mem + size; @@ -32,7 +32,7 @@ __heap_free (struct heap *heap, void *mem, size_t size) in the free-list when it becomes fragmented and long. [A better implemention would use a balanced tree or something for the free-list, though that bloats the code-size and complexity quite a bit.] */ - for (prev_fa = 0, fa = heap->free_areas; fa; prev_fa = fa, fa = fa->next) + for (prev_fa = 0, fa = heap; fa; prev_fa = fa, fa = fa->next) if (unlikely (HEAP_FREE_AREA_END (fa) >= mem)) break; -- cgit v1.2.3