From f27a5f8af9fc5a16b80a7d6646e44d718b0efd7d Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 9 Jan 2021 22:29:05 +0100 Subject: Finding memory leaks is SO exhausting argh --- libc/inc/mem.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'libc/inc') diff --git a/libc/inc/mem.h b/libc/inc/mem.h index 9075736..4750efb 100644 --- a/libc/inc/mem.h +++ b/libc/inc/mem.h @@ -5,15 +5,19 @@ #include +void *malloc_debug(u32 size, const char *file, int line, const char *func, const char *inp); +void free_debug(void *ptr, const char *file, int line, const char *func, const char *inp); +#define malloc(size) malloc_debug(size, __FILE__, __LINE__, __func__, #size) +#define free(ptr) free_debug(ptr, __FILE__, __LINE__, __func__, #ptr) + // Huh #ifdef kernel void heap_init(u32 start); -void *malloc(u32 size); -void free(void *ptr); +/* void *malloc(u32 size); */ +/* void free(void *ptr); */ #elif defined(userspace) -#include -void *malloc(u32 size); -void free(void *ptr); +/* void *malloc(u32 size); */ +/* void free(void *ptr); */ #else #error "No lib target specified. Please use -Dkernel or -Duserspace" #endif -- cgit v1.2.3