From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1gEb-0004aq-GA for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:14:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1gEa-0003u1-AA for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:14:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1gEa-0003tt-2x for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:14:16 -0400 From: Igor Mammedov Date: Wed, 15 Aug 2012 18:13:23 +0200 Message-Id: <1345047221-26898-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1345047221-26898-1-git-send-email-imammedo@redhat.com> References: <1345047221-26898-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/21] 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, stefanha@linux.vnet.ibm.com, gleb@redhat.com, vijaymohan.pandarathil@hp.com, jan.kiszka@siemens.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, ehabkost@redhat.com Signed-off-by: Igor Mammedov Acked-by: Andreas F=C3=A4rber --- target-i386/helper.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target-i386/helper.c b/target-i386/helper.c index 8a5da3d..a0e4c89 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_is_set(&error)) { + error_free(error); + object_delete(OBJECT(cpu)); + return NULL; + } return cpu; } =20 --=20 1.7.11.2