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 <j...@joshtriplett.org> --- 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