Skip to content

Commit

Permalink
Call appropriate release function
Browse files Browse the repository at this point in the history
mmap should be paired with munmap and malloc should be paired with free
  • Loading branch information
ChinYikMing committed Aug 1, 2023
1 parent 2f14ce1 commit d21591f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d21591f

Please sign in to comment.