aboutsummaryrefslogtreecommitdiff
path: root/target-i386/helper.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2012-10-02 17:36:55 +0200
committerAndreas Färber <afaerber@suse.de>2012-10-30 22:38:37 +0100
commitff287bbdda016b37990be7ed52339750aaa8a5e4 (patch)
tree8b81a4149e93210afcead0329668f2050d83e6b6 /target-i386/helper.c
parent18eb473f892642ae869f77403289167f30de2022 (diff)
target-i386: If x86_cpu_realize() failed, report error and do cleanup
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-i386/helper.c')
-rw-r--r--target-i386/helper.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c
index c5d42c5916..0424ccf6fb 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1243,6 +1243,7 @@ X86CPU *cpu_x86_init(const char *cpu_model)
{
X86CPU *cpu;
CPUX86State *env;
+ Error *error = NULL;
cpu = X86_CPU(object_new(TYPE_X86_CPU));
env = &cpu->env;
@@ -1253,8 +1254,12 @@ X86CPU *cpu_x86_init(const char *cpu_model)
return NULL;
}
- x86_cpu_realize(OBJECT(cpu), NULL);
-
+ x86_cpu_realize(OBJECT(cpu), &error);
+ if (error) {
+ error_free(error);
+ object_delete(OBJECT(cpu));
+ return NULL;
+ }
return cpu;
}