]> git.proxmox.com Git - qemu.git/commitdiff
target-i386: If x86_cpu_realize() failed, report error and do cleanup
authorIgor Mammedov <imammedo@redhat.com>
Tue, 2 Oct 2012 15:36:55 +0000 (17:36 +0200)
committerAndreas Färber <afaerber@suse.de>
Tue, 30 Oct 2012 21:38:37 +0000 (22:38 +0100)
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386/helper.c

index c5d42c591695bc24024a42c8f0f679c5d214dad5..0424ccf6fb29e5c880d1921ed87bcf8691ad5dda 100644 (file)
@@ -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;
 }