From 6292928a6da63255f209d8bdf88d6896b4386de2 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 1 Jul 2002 16:36:20 +0000 Subject: This patch, from Ronald Wahl , fixes the spots where I screwed up and forgot to fix realloc to use free_unlocked() instead of free(). Thanks Ronald! --- libc/stdlib/malloc-930716/malloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libc/stdlib/malloc-930716') diff --git a/libc/stdlib/malloc-930716/malloc.c b/libc/stdlib/malloc-930716/malloc.c index f4c147f0c..9f65caba9 100644 --- a/libc/stdlib/malloc-930716/malloc.c +++ b/libc/stdlib/malloc-930716/malloc.c @@ -468,7 +468,7 @@ void * realloc (void *ptr, size_t size) if (size <= BLOCKSIZE / 2) { if ((result = malloc_unlocked(size)) != NULL) { memcpy(result, ptr, size); - free(ptr); + free_unlocked(ptr); } UNLOCK; return result; @@ -484,7 +484,7 @@ void * realloc (void *ptr, size_t size) _heapinfo[block + blocks].busy.info.size = _heapinfo[block].busy.info.size - blocks; _heapinfo[block].busy.info.size = blocks; - free(ADDRESS(block + blocks)); + free_unlocked(ADDRESS(block + blocks)); UNLOCK; return ptr; } else if (blocks == _heapinfo[block].busy.info.size) { @@ -499,7 +499,7 @@ void * realloc (void *ptr, size_t size) /* Prevent free from actually returning memory to the system. */ oldlimit = _heaplimit; _heaplimit = 0; - free(ptr); + free_unlocked(ptr); _heaplimit = oldlimit; result = malloc_unlocked(size); if (!result) { @@ -511,7 +511,7 @@ void * realloc (void *ptr, size_t size) else { previous = malloc_unlocked((block - _heapindex) * BLOCKSIZE); malloc_unlocked(blocks * BLOCKSIZE); - free(previous); + free_unlocked(previous); } UNLOCK; return NULL; @@ -540,7 +540,7 @@ void * realloc (void *ptr, size_t size) return NULL; } memcpy(result, ptr, MIN(size, (size_t)(1 << type))); - free(ptr); + free_unlocked(ptr); UNLOCK; return result; } -- cgit v1.2.3