From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:32821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ4Xc-0006nE-Ej for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:37:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ4XV-0000Df-HU for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:37:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ4XV-0000DY-8I for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:37:41 -0400 From: Igor Mammedov Date: Tue, 2 Oct 2012 17:36:55 +0200 Message-Id: <1349192235-31895-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1349192235-31895-1-git-send-email-imammedo@redhat.com> References: <1349192235-31895-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 03/23] target-i386: if x86_cpu_realize() failed report error and do cleanup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, hpa@linux.intel.com, ehabkost@redhat.com, jan.kiszka@siemens.com, Don@cloudswitch.com, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, avi@redhat.com, pbonzini@redhat.com, akong@redhat.com, lersek@redhat.com, afaerber@suse.de, stefanha@linux.vnet.ibm.com Signed-off-by: Igor Mammedov Acked-by: Andreas F=C3=A4rber --- v2: - replaced "if (error_is_set(&error))" with "if (error)" --- target-i386/helper.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/target-i386/helper.c b/target-i386/helper.c index c635667..1d39ba9 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1243,6 +1243,7 @@ X86CPU *cpu_x86_init(const char *cpu_model) { X86CPU *cpu; CPUX86State *env; + Error *error =3D NULL; =20 cpu =3D X86_CPU(object_new(TYPE_X86_CPU)); env =3D &cpu->env; @@ -1253,8 +1254,12 @@ X86CPU *cpu_x86_init(const char *cpu_model) return NULL; } =20 - 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; } =20 --=20 1.7.1