From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TA5aR-0002RS-5X for qemu-devel@nongnu.org; Fri, 07 Sep 2012 16:55:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TA5aQ-000564-7P for qemu-devel@nongnu.org; Fri, 07 Sep 2012 16:55:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TA5aP-00055z-VC for qemu-devel@nongnu.org; Fri, 07 Sep 2012 16:55:34 -0400 From: Igor Mammedov Date: Fri, 7 Sep 2012 22:54:52 +0200 Message-Id: <1347051311-16122-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1347051311-16122-1-git-send-email-imammedo@redhat.com> References: <1347051311-16122-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: peter.maydell@linaro.org, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, jan.kiszka@siemens.com, mdroth@linux.vnet.ibm.com, don.slutz@gmail.com, blauwirbel@gmail.com, avi@redhat.com, pbonzini@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.4