aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-08-02 18:56:05 +0200
committerAndreas Färber <afaerber@suse.de>2013-08-06 19:27:20 +0200
commitcd7b87ffe9b6b7b0089ec8c71555f3b942bc6daf (patch)
tree91311bcd9e685a0078a9d5ce0725de1ff506ba12 /target-i386
parenta1fc6246b3964e74ddb3a7e0b8bba03af1c6ac38 (diff)
downloadqemu-cd7b87ffe9b6b7b0089ec8c71555f3b942bc6daf.zip
qemu-cd7b87ffe9b6b7b0089ec8c71555f3b942bc6daf.tar.gz
qemu-cd7b87ffe9b6b7b0089ec8c71555f3b942bc6daf.tar.bz2
target-i386: Fix X86CPU error handling
Error **errp argument is not for emitting warnings, it means an error has occurred and the caller should not make any assumptions about the state of other return values (unless otherwise documented). Therefore cpu_x86_create() must unref the new X86CPU itself, and pc_new_cpu() must check for an Error rather than NULL return value. While at it, clean up a superfluous NULL check. Reported-by: Jan Kiszka <jan.kiszka@siemens.com> Cc: qemu-stable@nongnu.org Cc: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 71ab915..2efbeca 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1824,7 +1824,11 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
}
out:
- error_propagate(errp, error);
+ if (error != NULL) {
+ error_propagate(errp, error);
+ object_unref(OBJECT(cpu));
+ cpu = NULL;
+ }
g_strfreev(model_pieces);
return cpu;
}