mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
cpuCompare: Fix crash on unexpected CPU XML
When comparing a CPU without <model> element, such as <cpu> <topology sockets='1' cores='1' threads='1'/> </cpu> libvirt would happily crash without warning.
This commit is contained in:
parent
517aba9fac
commit
f5055f2310
@ -90,6 +90,12 @@ cpuCompareXML(virCPUDefPtr host,
|
|||||||
if (cpu == NULL)
|
if (cpu == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!cpu->model) {
|
||||||
|
virCPUReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
|
"%s", _("no CPU model specified"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
ret = cpuCompare(host, cpu);
|
ret = cpuCompare(host, cpu);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
Reference in New Issue
Block a user