diff options
-rw-r--r-- | blastem.c | 2 | ||||
-rw-r--r-- | genesis.c | 1 | ||||
-rw-r--r-- | m68k_core.c | 12 | ||||
-rw-r--r-- | png.c | 1 | ||||
-rw-r--r-- | romdb.c | 3 | ||||
-rw-r--r-- | util.c | 3 | ||||
-rw-r--r-- | z80_to_x86.c | 12 |
7 files changed, 31 insertions, 3 deletions
@@ -259,7 +259,7 @@ void setup_saves(system_media *media, rom_info *info, system_header *context) //initial save dir was calculated based on lock-on cartridge because that's where the save device is //save directory used for save states should still be located in the normal place free(save_dir); - save_dir = get_save_dir(media); + parts[0] = save_dir = get_save_dir(media); } if (use_native_states || context->type != SYSTEM_GENESIS) { parts[2] = "quicksave.state"; @@ -1301,7 +1301,6 @@ genesis_context *alloc_init_genesis(rom_info *rom, void *main_rom, void *lock_on gen->psg = malloc(sizeof(psg_context)); psg_init(gen->psg, gen->master_clock, MCLKS_PER_PSG); - gen->zram = calloc(1, Z80_RAM_BYTES); z80_map[0].buffer = gen->zram = calloc(1, Z80_RAM_BYTES); #ifndef NO_Z80 z80_options *z_opts = malloc(sizeof(z80_options)); 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); } @@ -430,6 +430,7 @@ uint32_t *load_png(uint8_t *buffer, uint32_t buf_size, uint32_t *width, uint32_t } last_line = line_start; } + free(decomp_buffer); } else { //skip uncrecognized chunks cur += 4 + chunk_size; @@ -51,6 +51,8 @@ void free_rom_info(rom_info *info) free(info->save_buffer); if (info->save_type == SAVE_I2C) { free(info->eeprom_map); + } else if (info->save_type == SAVE_NOR) { + free(info->nor); } } free(info->map); @@ -58,7 +60,6 @@ void free_rom_info(rom_info *info) free(info->port2_override); free(info->ext_override); free(info->mouse_mode); - free(info->nor); } void cart_serialize(system_header *sys, serialize_buffer *buf) @@ -359,9 +359,11 @@ uint8_t path_matches_extensions(char *path, char **ext_list, uint32_t num_exts) for (extidx = 0; extidx < num_exts; extidx++) { if (!strcasecmp(ext, ext_list[extidx])) { + free(ext); return 1; } } + free(ext); return 0; } @@ -721,6 +723,7 @@ dir_entry *get_dir_list(char *path, size_t *numret) if (numret) { *numret = pos; } + closedir(d); return ret; } diff --git a/z80_to_x86.c b/z80_to_x86.c index d2341a2..cd51389 100644 --- a/z80_to_x86.c +++ b/z80_to_x86.c @@ -3671,7 +3671,19 @@ void z80_run(z80_context * context, uint32_t target_cycle) void z80_options_free(z80_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); } |