Mercurial > repos > blastem
comparison m68k_core.c @ 1593:24508cb54f87
Fix a number of other memory errors (mostly leaks again) identified by valgrind
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 28 Jun 2018 09:27:05 -0700 |
parents | 31effaadf877 |
children | b7ecd0d6a77b eda8df5bc74c |
comparison
equal
deleted
inserted
replaced
1592:31effaadf877 | 1593:24508cb54f87 |
---|---|
466 ) { | 466 ) { |
467 return opts->big_movem[i].impl; | 467 return opts->big_movem[i].impl; |
468 } | 468 } |
469 } | 469 } |
470 if (opts->num_movem == opts->movem_storage) { | 470 if (opts->num_movem == opts->movem_storage) { |
471 opts->movem_storage *= 2; | 471 if (!opts->movem_storage) { |
472 opts->movem_storage = 4; | |
473 } else { | |
474 opts->movem_storage *= 2; | |
475 } | |
472 opts->big_movem = realloc(opts->big_movem, sizeof(movem_fun) * opts->movem_storage); | 476 opts->big_movem = realloc(opts->big_movem, sizeof(movem_fun) * opts->movem_storage); |
473 } | 477 } |
474 if (!opts->extra_code.cur) { | 478 if (!opts->extra_code.cur) { |
475 init_code_info(&opts->extra_code); | 479 init_code_info(&opts->extra_code); |
476 } | 480 } |
1203 for (uint32_t i = 0; i < ram_inst_slots; i++) | 1207 for (uint32_t i = 0; i < ram_inst_slots; i++) |
1204 { | 1208 { |
1205 free(opts->gen.ram_inst_sizes[i]); | 1209 free(opts->gen.ram_inst_sizes[i]); |
1206 } | 1210 } |
1207 free(opts->gen.ram_inst_sizes); | 1211 free(opts->gen.ram_inst_sizes); |
1212 free(opts->big_movem); | |
1208 free(opts); | 1213 free(opts); |
1209 } | 1214 } |
1210 | 1215 |
1211 | 1216 |
1212 m68k_context * init_68k_context(m68k_options * opts, m68k_reset_handler reset_handler) | 1217 m68k_context * init_68k_context(m68k_options * opts, m68k_reset_handler reset_handler) |