From d21591f09f2a61b1018144e343efdb566d6bc733 Mon Sep 17 00:00:00 2001 From: Chin Yik Ming Date: Tue, 1 Aug 2023 21:39:39 +0800 Subject: [PATCH] Call appropriate release function mmap should be paired with munmap and malloc should be paired with free --- src/io.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/io.c b/src/io.c index 59b6fd20..ad78c50f 100644 --- a/src/io.c +++ b/src/io.c @@ -40,7 +40,11 @@ memory_t *memory_new() void memory_delete(memory_t *mem) { +#if defined(USE_MMAP) munmap(mem->mem_base, MEM_SIZE); +#else + free(mem->mem_base); +#endif } void memory_read(memory_t *mem, uint8_t *dst, uint32_t addr, uint32_t size)