summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc')
-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