Mercurial > repos > blastem
diff m68k_core.c @ 1592:31effaadf877
Fix some memory errors (mostly leaks) identified by valgrind
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 22 Jun 2018 23:10:27 -0700 |
parents | e01adbe1a75b |
children | 24508cb54f87 |
line wrap: on
line diff
--- a/m68k_core.c Fri Jun 22 21:11:38 2018 -0700 +++ b/m68k_core.c Fri Jun 22 23:10:27 2018 -0700 @@ -1191,7 +1191,19 @@ 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); }