Signed-off-by: Eduardo Habkost <[email protected]>
---
target-i386/cpu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index f30e621..7821331 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1489,12 +1489,15 @@ X86CPU *cpu_x86_create(const char *cpu_model)
env = &cpu->env;
env->cpu_model_str = cpu_model;
if (cpu_x86_register(cpu, cpu_model) < 0) {
- object_delete(OBJECT(cpu));
- return NULL;
+ goto error;
}
x86_cpu_realize(OBJECT(cpu), NULL);
return cpu;
+
+error:
+ object_delete(OBJECT(cpu));
+ return NULL;
}
#if !defined(CONFIG_USER_ONLY)
--
1.7.11.2