提交 ff287bbd 编写于 作者: I Igor Mammedov 提交者: Andreas Färber

target-i386: If x86_cpu_realize() failed, report error and do cleanup

Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 18eb473f
...@@ -1243,6 +1243,7 @@ X86CPU *cpu_x86_init(const char *cpu_model) ...@@ -1243,6 +1243,7 @@ X86CPU *cpu_x86_init(const char *cpu_model)
{ {
X86CPU *cpu; X86CPU *cpu;
CPUX86State *env; CPUX86State *env;
Error *error = NULL;
cpu = X86_CPU(object_new(TYPE_X86_CPU)); cpu = X86_CPU(object_new(TYPE_X86_CPU));
env = &cpu->env; env = &cpu->env;
...@@ -1253,8 +1254,12 @@ X86CPU *cpu_x86_init(const char *cpu_model) ...@@ -1253,8 +1254,12 @@ X86CPU *cpu_x86_init(const char *cpu_model)
return NULL; 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; return cpu;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册