aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-15 18:51:01 +0200
committerBlue Swirl <blauwirbel@gmail.com>2012-04-15 16:54:46 +0000
commit11ea40905259f29e448af816ff00d9d9f0951818 (patch)
tree15faac0729250a36046ea28743f934fe47cbcfb9 /linux-user
parentda12872a0973718997c00f1c1e8e5b91ee4c713a (diff)
linux-user: Fix exit syscall with QOM CPU
For QOM'ified CPUs we cannot g_free() CPUArchState, we must object_delete() the object it is embedded into. Fixes LP#982321 (invalid free() while executing pacman with qemu-arm). Reported-by: Serge Schneider <serge@xecdesign.com> Reported-by: Russell Keith Davis <russell@russelldavis.org> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Serge Schneider <serge@xecdesign.com> Tested-by: Russell Keith Davis <russell@russelldavis.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8a92162155..712861829a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5045,7 +5045,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
NULL, NULL, 0);
}
thread_env = NULL;
+#ifdef ENV_GET_CPU
+ object_delete(OBJECT(ENV_GET_CPU(cpu_env)));
+#else
g_free(cpu_env);
+#endif
g_free(ts);
pthread_exit(NULL);
}