diff options
author | jdgleaver | 2022-03-22 13:39:12 +0000 |
---|---|---|
committer | jdgleaver | 2022-03-22 13:39:12 +0000 |
commit | d22597e9032ee8024b477af78000704ec072e49b (patch) | |
tree | 652add684a4e5d7cda11381507618f57f4c292d8 | |
parent | e36e336192603850229d0fd7e5cd5d8ac9189f6f (diff) | |
download | snes9x2005-d22597e9032ee8024b477af78000704ec072e49b.tar.gz snes9x2005-d22597e9032ee8024b477af78000704ec072e49b.tar.bz2 snes9x2005-d22597e9032ee8024b477af78000704ec072e49b.zip |
Fix memory leaks
-rw-r--r-- | source/memmap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/memmap.c b/source/memmap.c index d7986e1..8db9f93 100644 --- a/source/memmap.c +++ b/source/memmap.c @@ -217,7 +217,7 @@ static int32_t ScoreLoROM(bool skip_header, int32_t romoff) static char* Safe(const char* s) { - static char* safe; + static char* safe = NULL; static int32_t safe_len = 0; int32_t i; int32_t len; @@ -338,7 +338,7 @@ void S9xDeinitMemory(void) Memory.BSRAM = NULL; } - for (t = 0; t < 2; t++) + for (t = 0; t <= TILE_8BIT; t++) { if (IPPU.TileCache[t]) { @@ -351,6 +351,10 @@ void S9xDeinitMemory(void) IPPU.TileCached[t] = NULL; } } + + /* Ensure that we free the static char + * array allocated by Safe() */ + Safe(NULL); } #ifndef LOAD_FROM_MEMORY |