[libvirt] [PATCH v2 1/3] qemu: agent: fix uninitialized var case in qemuAgentGetFSInfo

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Mon Dec 12 09:13:42 UTC 2016


In case of 0 filesystems *info is not set while according
to virDomainGetFSInfo contract user should call free on it even
in case of 0 filesystems. Thus we need to properly set
it. NULL will be enough as free eats NULLs ok.
---
 src/qemu/qemu_agent.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 1d677f7..c50f760 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1872,6 +1872,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
     ndata = virJSONValueArraySize(data);
     if (!ndata) {
         ret = 0;
+        *info = NULL;
         goto cleanup;
     }
     if (VIR_ALLOC_N(info_ret, ndata) < 0)
-- 
1.8.3.1




More information about the libvir-list mailing list