From 6c280f3b1f8e072f86fc41b371cf616be1483030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=3D=3FUTF-8=3Fq=3FHigor=3D20Eur=3DC3=3DADpedes=3F=3D?= Date: Sun, 26 Jul 2015 11:00:25 -0700 Subject: Fix some memory issues --- m68k_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'm68k_core.c') diff --git a/m68k_core.c b/m68k_core.c index 5d88a2d..6b48080 100644 --- a/m68k_core.c +++ b/m68k_core.c @@ -1004,8 +1004,9 @@ void m68k_reset(m68k_context * context) m68k_context * init_68k_context(m68k_options * opts) { - m68k_context * context = malloc(sizeof(m68k_context) + ram_size(&opts->gen) / (1 << opts->gen.ram_flags_shift) / 8); - memset(context, 0, sizeof(m68k_context)); + size_t ctx_size = sizeof(m68k_context) + ram_size(&opts->gen) / (1 << opts->gen.ram_flags_shift) / 8; + m68k_context * context = malloc(ctx_size); + memset(context, 0, ctx_size); context->native_code_map = opts->gen.native_code_map; context->options = opts; context->int_cycle = CYCLE_NEVER; -- cgit v1.2.3