From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmSDF-00034P-PP for qemu-devel@nongnu.org; Sun, 15 Jan 2012 10:41:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmSDB-0007bh-II for qemu-devel@nongnu.org; Sun, 15 Jan 2012 10:41:41 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:34383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmSDB-0007bX-80 for qemu-devel@nongnu.org; Sun, 15 Jan 2012 10:41:37 -0500 Date: Mon, 16 Jan 2012 02:41:29 +1100 From: Josh Triplett Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH 3/3] Handle parse failures in CPU definitions, and avoid adding a partial cpudef List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Paul Brook Without this change, a parse failure would stop the processing of the cpudef entry, but the partially-parsed CPU definition would still get added to the list of CPUs. Signed-off-by: Josh Triplett --- target-i386/cpuid.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index ea55f69..c2a95c4 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -1065,7 +1065,10 @@ static int cpudef_register(QemuOpts *opts, void *opaque) { x86_def_t *def = g_malloc0(sizeof (x86_def_t)); - qemu_opt_foreach(opts, cpudef_setfield, def, 1); + if (qemu_opt_foreach(opts, cpudef_setfield, def, 1) != 0) { + g_free(def); + return 1; + } def->msr_gpf = qemu_opt_get_bool(opts, "msr_gpf", false); def->next = x86_defs; x86_defs = def; -- 1.7.8.3