Patchwork [8/8] target-arm: Fix use of free() in cpu_arm_close()

login
register
mail settings
Submitter Peter Maydell
Date Oct. 20, 2011, 2:36 p.m.
Message ID <1319121368-2899-2-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/120827/
State New
Headers show

Comments

Peter Maydell - Oct. 20, 2011, 2:36 p.m.
From: Andreas Färber <afaerber@suse.de>

env is allocated in cpu_arm_init() with g_malloc0(), so free with g_free().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index eddb923..97af4d0 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -475,7 +475,7 @@  static uint32_t cpu_arm_find_by_name(const char *name)
 
 void cpu_arm_close(CPUARMState *env)
 {
-    free(env);
+    g_free(env);
 }
 
 uint32_t cpsr_read(CPUARMState *env)