Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index da7b5af..0bf62da 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1544,12 +1544,14 @@ X86CPU *cpu_x86_create(const char *cpu_model) 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