qemuDomainGetResctrlMonData: Dereference resctrl monitor iff not NULL

If the host doesn't have resctrl then the monitor is going to be
NULL and we must avoid dereferencing it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2019-08-06 13:44:17 +02:00
parent 9801ee899f
commit 9fc616cc10

View File

@ -20744,7 +20744,8 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver,
caps = virQEMUDriverGetCapabilities(driver, false);
if (tag == VIR_RESCTRL_MONITOR_TYPE_CACHE) {
features = caps->host.cache.monitor->features;
if (caps->host.cache.monitor)
features = caps->host.cache.monitor->features;
} else {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("Unsupported resctrl monitor type"));