1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu: Fix possible NULL deref in qemuDomainGetResctrlMonData

If virQEMUDriverGetCapabilities returns NULL, then a subsequent
deref of @caps would cause an error, so we just return failure.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
John Ferlan 2019-08-07 09:54:06 -04:00
parent a067b781e9
commit 4e02d52ab9

View File

@ -20728,7 +20728,8 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver,
size_t i = 0;
size_t j = 0;
caps = virQEMUDriverGetCapabilities(driver, false);
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
return -1;
switch (tag) {
case VIR_RESCTRL_MONITOR_TYPE_CACHE: