From: Jiri Denemark Date: Mon, 12 Jul 2010 15:30:23 +0000 (+0200) Subject: cpuCompare: Fix crash on unexpected CPU XML X-Git-Tag: v0.8.3~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5055f2310950633510dd808d1b67123e13d6f03;p=thirdparty%2Flibvirt.git cpuCompare: Fix crash on unexpected CPU XML When comparing a CPU without element, such as libvirt would happily crash without warning. --- diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 279eee7d37..def69749a4 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -90,6 +90,12 @@ cpuCompareXML(virCPUDefPtr host, if (cpu == NULL) goto cleanup; + if (!cpu->model) { + virCPUReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("no CPU model specified")); + goto cleanup; + } + ret = cpuCompare(host, cpu); cleanup: