Mercurial > repos > blastem
comparison z80_to_x86.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 | 5a6339e46917 |
children | 873a1330c3a9 |
comparison
equal
deleted
inserted
replaced
1591:5cfc7e4a207e | 1592:31effaadf877 |
---|---|
3669 } | 3669 } |
3670 } | 3670 } |
3671 | 3671 |
3672 void z80_options_free(z80_options *opts) | 3672 void z80_options_free(z80_options *opts) |
3673 { | 3673 { |
3674 for (uint32_t address = 0; address < opts->gen.address_mask; address += NATIVE_CHUNK_SIZE) | |
3675 { | |
3676 uint32_t chunk = address / NATIVE_CHUNK_SIZE; | |
3677 if (opts->gen.native_code_map[chunk].base) { | |
3678 free(opts->gen.native_code_map[chunk].offsets); | |
3679 } | |
3680 } | |
3674 free(opts->gen.native_code_map); | 3681 free(opts->gen.native_code_map); |
3682 uint32_t ram_inst_slots = ram_size(&opts->gen) / 1024; | |
3683 for (uint32_t i = 0; i < ram_inst_slots; i++) | |
3684 { | |
3685 free(opts->gen.ram_inst_sizes[i]); | |
3686 } | |
3675 free(opts->gen.ram_inst_sizes); | 3687 free(opts->gen.ram_inst_sizes); |
3676 free(opts); | 3688 free(opts); |
3677 } | 3689 } |
3678 | 3690 |
3679 void z80_assert_reset(z80_context * context, uint32_t cycle) | 3691 void z80_assert_reset(z80_context * context, uint32_t cycle) |