]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainGetResctrlMonData: Dereference resctrl monitor iff not NULL
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 6 Aug 2019 11:44:17 +0000 (13:44 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 6 Aug 2019 12:37:30 +0000 (14:37 +0200)
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>
src/qemu/qemu_driver.c

index d5a8beb13427bd04aedfaabd69dabc2338c2e33d..25b6653e3815698647d9ae04f59ee8b87f60a1d6 100644 (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"));