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(a)redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f1983f33e6..ff83d1c024 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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:
--
2.20.1