Received: from eggs.gnu.org ([140.186.70.92]:41849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIZNs-0006lL-M7 for qemu-devel@nongnu.org; Tue, 25 Oct 2011 01:17:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIZNr-0001Ja-EM for qemu-devel@nongnu.org; Tue, 25 Oct 2011 01:17:08 -0400 From: Stefan Weil Date: Tue, 25 Oct 2011 07:16:25 +0200 Message-Id: <1319519785-6220-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH] target-sparc: Fix use of g_new0 / g_free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Stefan Weil , Blue Swirl 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 Signed-off-by: Stefan Weil --- target-sparc/cpu_init.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target-sparc/cpu_init.c b/target-sparc/cpu_init.c index 08b72a9..6954800 100644 --- a/target-sparc/cpu_init.c +++ b/target-sparc/cpu_init.c @@ -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); -- 1.7.2.5