提交 d300854b 编写于 作者: S Stefan Weil 提交者: Blue Swirl

target-sparc: Fix use of g_new0 / g_free

g_malloc0 needs g_free instead of free.
While fixing this, I also replaced g_malloc0 by g_new0
as was suggested by Stuart Brady.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: NStefan Weil <sw@weilnetz.de>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 f37e2a6b
......@@ -74,7 +74,7 @@ static int cpu_sparc_register(CPUSPARCState *env, const char *cpu_model)
return -1;
}
env->def = g_malloc0(sizeof(*def));
env->def = g_new0(sparc_def_t, 1);
memcpy(env->def, def, sizeof(*def));
#if defined(CONFIG_USER_ONLY)
if ((env->def->features & CPU_FEATURE_FLOAT)) {
......@@ -100,15 +100,15 @@ static int cpu_sparc_register(CPUSPARCState *env, const char *cpu_model)
static void cpu_sparc_close(CPUSPARCState *env)
{
free(env->def);
free(env);
g_free(env->def);
g_free(env);
}
CPUSPARCState *cpu_sparc_init(const char *cpu_model)
{
CPUSPARCState *env;
env = g_malloc0(sizeof(CPUSPARCState));
env = g_new0(CPUSPARCState, 1);
cpu_exec_init(env);
gen_intermediate_code_init(env);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册