summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-11 16:25:55 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-11 16:25:55 +0000
commit9b39f1ce8980202bcd9db6be04b462e766d7d91c (patch)
treedfbf6d1253feb46f2b9730c33394dd5dbcea19f7 /libc/stdlib
parent007b8e2060ccae6159a36c52db42d04b13fa2b6f (diff)
A patch from Matthias Kilian <kili@outback.escape.de> to fix -DDEBUG_MALLOC
so that it works for realloc too. -Erik
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/malloc/Makefile2
-rw-r--r--libc/stdlib/malloc/alloc.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile
index d4d278949..c2190dcdc 100644
--- a/libc/stdlib/malloc/Makefile
+++ b/libc/stdlib/malloc/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)Rules.mak
LIBC=$(TOPDIR)libc.a
MSRC=alloc.c
-MOBJ=malloc_dbg.o free_dbg.o calloc_dbg.o
+MOBJ=malloc_dbg.o free_dbg.o calloc_dbg.o realloc_dbg.o
MSRC1=malloc.c
MOBJ1=_avl_support.o _free_support.o _malloc_init.o _realloc_no_move.o calloc.o \
diff --git a/libc/stdlib/malloc/alloc.c b/libc/stdlib/malloc/alloc.c
index 4988bb055..a521cf2e8 100644
--- a/libc/stdlib/malloc/alloc.c
+++ b/libc/stdlib/malloc/alloc.c
@@ -47,3 +47,14 @@ void free_dbg(void *ptr, char *function, char *file, int line)
}
#endif
+
+#ifdef L_realloc_dbg
+void *realloc_dbg(void *ptr, size_t size, char *function, char *file, int line)
+{
+ fprintf(stderr, "realloc of %p to %ld bytes at %s @%s;%d = ", ptr,
+ size, function, file, line);
+ ptr = realloc(ptr, size);
+ fprintf(stderr, "%p\n", ptr);
+ return ptr;
+}
+#endif