Browse Source

Fix heap corruption in malloc

Use SDL's malloc functions in abstractions.
master
TheoryOfNekomata 1 year ago
parent
commit
8c9e34b691
2 changed files with 4 additions and 4 deletions
  1. +3
    -3
      src/packages/stdinc/IZ_stdlib.c
  2. +1
    -1
      src/packages/stdinc/IZ_stdlib.h

+ 3
- 3
src/packages/stdinc/IZ_stdlib.c View File

@@ -1,13 +1,13 @@
#include "IZ_stdlib.h" #include "IZ_stdlib.h"


void* IZ_malloc(size_t size) { void* IZ_malloc(size_t size) {
return malloc(size);
return SDL_malloc(size);
} }


void* IZ_calloc(unsigned int count, size_t size) { void* IZ_calloc(unsigned int count, size_t size) {
return calloc(count, size);
return SDL_calloc(count, size);
} }


void IZ_free(void* p) { void IZ_free(void* p) {
free(p);
SDL_free(p);
} }

+ 1
- 1
src/packages/stdinc/IZ_stdlib.h View File

@@ -1,7 +1,7 @@
#ifndef IZ_STDLIB_H #ifndef IZ_STDLIB_H
#define IZ_STDLIB_H #define IZ_STDLIB_H


#include <stdlib.h>
#include <SDL_stdinc.h>


void* IZ_malloc(size_t); void* IZ_malloc(size_t);
void* IZ_calloc(unsigned int, size_t); void* IZ_calloc(unsigned int, size_t);


Loading…
Cancel
Save