From 8c9e34b6919e80c2e216cd45bc9c379dbd93a328 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Mon, 13 Feb 2023 10:59:22 +0800 Subject: [PATCH] Fix heap corruption in malloc Use SDL's malloc functions in abstractions. --- src/packages/stdinc/IZ_stdlib.c | 6 +++--- src/packages/stdinc/IZ_stdlib.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/packages/stdinc/IZ_stdlib.c b/src/packages/stdinc/IZ_stdlib.c index eb93679..da2f137 100644 --- a/src/packages/stdinc/IZ_stdlib.c +++ b/src/packages/stdinc/IZ_stdlib.c @@ -1,13 +1,13 @@ #include "IZ_stdlib.h" void* IZ_malloc(size_t size) { - return malloc(size); + return SDL_malloc(size); } void* IZ_calloc(unsigned int count, size_t size) { - return calloc(count, size); + return SDL_calloc(count, size); } void IZ_free(void* p) { - free(p); + SDL_free(p); } diff --git a/src/packages/stdinc/IZ_stdlib.h b/src/packages/stdinc/IZ_stdlib.h index 9e5c3a3..2a64b88 100644 --- a/src/packages/stdinc/IZ_stdlib.h +++ b/src/packages/stdinc/IZ_stdlib.h @@ -1,7 +1,7 @@ #ifndef IZ_STDLIB_H #define IZ_STDLIB_H -#include +#include void* IZ_malloc(size_t); void* IZ_calloc(unsigned int, size_t);