qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] Handle parse failures in CPU definitions, and a


From: Josh Triplett
Subject: [Qemu-devel] [PATCH 3/3] Handle parse failures in CPU definitions, and avoid adding a partial cpudef
Date: Mon, 16 Jan 2012 02:41:29 +1100
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]