Message ID | ea6445f9292c229e4a47ac604feb11ef5b2efb74.1326641605.git.josh@joshtriplett.org |
---|---|
State | New |
Headers | show |
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;
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 <josh@joshtriplett.org> --- target-i386/cpuid.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)