summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc-930716
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-07-01 16:36:20 +0000
committerEric Andersen <andersen@codepoet.org>2002-07-01 16:36:20 +0000
commit6292928a6da63255f209d8bdf88d6896b4386de2 (patch)
treee984d3b1770933d0a2857c5177c3243d96b3c8a2 /libc/stdlib/malloc-930716
parent82ba14bc472e809d2090b97b6a3b9e6bd72760da (diff)
This patch, from Ronald Wahl <rwa@peppercon.com>, fixes the
spots where I screwed up and forgot to fix realloc to use free_unlocked() instead of free(). Thanks Ronald!
Diffstat (limited to 'libc/stdlib/malloc-930716')
-rw-r--r--libc/stdlib/malloc-930716/malloc.c10
1 files changed, 5 insertions, 5 deletions
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;
}