From 0be050c8b6579abd76f4a405a1964532d4e71bf1 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 16 Oct 2008 21:16:46 +0000 Subject: This should fix malloc with debug and without threads. (Chase N Douglas) This should have been in r23660. Untested. --- libc/stdlib/malloc/heap_debug.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libc/stdlib/malloc/heap_debug.c') diff --git a/libc/stdlib/malloc/heap_debug.c b/libc/stdlib/malloc/heap_debug.c index a2a9f4ec1..59a1780cd 100644 --- a/libc/stdlib/malloc/heap_debug.c +++ b/libc/stdlib/malloc/heap_debug.c @@ -31,10 +31,10 @@ int __heap_debug = 0; static void -__heap_dump_freelist (struct heap *heap) +__heap_dump_freelist (struct heap_free_area *heap) { struct heap_free_area *fa; - for (fa = heap->free_areas; fa; fa = fa->next) + for (fa = heap; fa; fa = fa->next) __malloc_debug_printf (0, "0x%lx: 0x%lx - 0x%lx (%d)\tP=0x%lx, N=0x%lx", (long)fa, @@ -47,7 +47,7 @@ __heap_dump_freelist (struct heap *heap) /* Output a text representation of HEAP to stderr, labelling it with STR. */ void -__heap_dump (struct heap *heap, const char *str) +__heap_dump (struct heap_free_area *heap, const char *str) { static smallint recursed; @@ -69,7 +69,7 @@ __heap_dump (struct heap *heap, const char *str) /* Output an error message to stderr, and exit. STR is printed with the failure message. */ static void attribute_noreturn -__heap_check_failure (struct heap *heap, struct heap_free_area *fa, +__heap_check_failure (struct heap_free_area *heap, struct heap_free_area *fa, const char *str, char *fmt, ...) { va_list val; @@ -95,11 +95,11 @@ __heap_check_failure (struct heap *heap, struct heap_free_area *fa, /* Do some consistency checks on HEAP. If they fail, output an error message to stderr, and exit. STR is printed with the failure message. */ void -__heap_check (struct heap *heap, const char *str) +__heap_check (struct heap_free_area *heap, const char *str) { typedef unsigned long ul_t; struct heap_free_area *fa, *prev; - struct heap_free_area *first_fa = heap->free_areas; + struct heap_free_area *first_fa = heap; if (first_fa && first_fa->prev) __heap_check_failure (heap, first_fa, str, -- cgit v1.2.3