comparison m68k_core.c @ 796:41f73c76b978

Fix some memory issues
author =?UTF-8?q?Higor=20Eur=C3=ADpedes?= <heuripedes@gmail.com>
date Sun, 26 Jul 2015 11:00:25 -0700
parents 7367b14ac01c
children 0b692b5d154b
comparison
equal deleted inserted replaced
795:bce97fc0bb8a 796:41f73c76b978
1002 } 1002 }
1003 1003
1004 1004
1005 m68k_context * init_68k_context(m68k_options * opts) 1005 m68k_context * init_68k_context(m68k_options * opts)
1006 { 1006 {
1007 m68k_context * context = malloc(sizeof(m68k_context) + ram_size(&opts->gen) / (1 << opts->gen.ram_flags_shift) / 8); 1007 size_t ctx_size = sizeof(m68k_context) + ram_size(&opts->gen) / (1 << opts->gen.ram_flags_shift) / 8;
1008 memset(context, 0, sizeof(m68k_context)); 1008 m68k_context * context = malloc(ctx_size);
1009 memset(context, 0, ctx_size);
1009 context->native_code_map = opts->gen.native_code_map; 1010 context->native_code_map = opts->gen.native_code_map;
1010 context->options = opts; 1011 context->options = opts;
1011 context->int_cycle = CYCLE_NEVER; 1012 context->int_cycle = CYCLE_NEVER;
1012 context->status = 0x27; 1013 context->status = 0x27;
1013 return context; 1014 return context;