[libvirt] [PATCH 4/6] qemu: Resolve Coverity CHECKED_RETURN issue

John Ferlan jferlan at redhat.com
Fri Mar 6 18:47:10 UTC 2015


By adding a call and check of return of virBitmapToData to the
IOThreads code, my Coverity checker lets me know qemuDomainHelperGetVcpus
also needs to check the status...

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_driver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 207c62c..c1f4e95 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1420,7 +1420,10 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm, virVcpuInfoPtr info, int maxinfo,
                 if (virProcessGetAffinity(priv->vcpupids[v],
                                           &map, maxcpu) < 0)
                     return -1;
-                virBitmapToData(map, &tmpmap, &tmpmapLen);
+                if (virBitmapToData(map, &tmpmap, &tmpmapLen) < 0) {
+                    virBitmapFree(map);
+                    return -1;
+                }
                 if (tmpmapLen > maplen)
                     tmpmapLen = maplen;
                 memcpy(cpumap, tmpmap, tmpmapLen);
-- 
2.1.0




More information about the libvir-list mailing list