From f5055f2310950633510dd808d1b67123e13d6f03 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Mon, 12 Jul 2010 17:30:23 +0200 Subject: [PATCH] cpuCompare: Fix crash on unexpected CPU XML When comparing a CPU without element, such as libvirt would happily crash without warning. --- src/cpu/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) 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: