diff options
author | Michael Pavone <pavone@retrodev.com> | 2018-06-22 23:10:27 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2018-06-22 23:10:27 -0700 |
commit | e1d177b8429e4eb59f5a6e853009dbf97ab95068 (patch) | |
tree | 4733ff57c8a2fbac7470ca64d89852ae01908686 /m68k_core.c | |
parent | e9dcae6c35185d58f41d49b8952f9d55984532fd (diff) |
Fix some memory errors (mostly leaks) identified by valgrind
Diffstat (limited to 'm68k_core.c')
-rw-r--r-- | m68k_core.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/m68k_core.c b/m68k_core.c index eee407a..a118b18 100644 --- a/m68k_core.c +++ b/m68k_core.c @@ -1191,7 +1191,19 @@ void m68k_reset(m68k_context * context) void m68k_options_free(m68k_options *opts) { + for (uint32_t address = 0; address < opts->gen.address_mask; address += NATIVE_CHUNK_SIZE) + { + uint32_t chunk = address / NATIVE_CHUNK_SIZE; + if (opts->gen.native_code_map[chunk].base) { + free(opts->gen.native_code_map[chunk].offsets); + } + } free(opts->gen.native_code_map); + uint32_t ram_inst_slots = ram_size(&opts->gen) / 1024; + for (uint32_t i = 0; i < ram_inst_slots; i++) + { + free(opts->gen.ram_inst_sizes[i]); + } free(opts->gen.ram_inst_sizes); free(opts); } |