From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGyIh-00042e-Vk for qemu-devel@nongnu.org; Wed, 26 Sep 2012 16:33:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGyIe-0004BU-T6 for qemu-devel@nongnu.org; Wed, 26 Sep 2012 16:33:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGyIe-0004BL-Ks for qemu-devel@nongnu.org; Wed, 26 Sep 2012 16:33:40 -0400 From: Igor Mammedov Date: Wed, 26 Sep 2012 22:32:39 +0200 Message-Id: <1348691578-17231-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1348691578-17231-1-git-send-email-imammedo@redhat.com> References: <1348691578-17231-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/22] 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, ehabkost@redhat.com, jan.kiszka@siemens.com, Don@CloudSwitch.com, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, pbonzini@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 8a5da3d..3038198 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1151,6 +1151,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; @@ -1161,8 +1162,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