]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: agent: fix uninitialized var case in qemuAgentGetFSInfo
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Mon, 12 Dec 2016 09:13:42 +0000 (12:13 +0300)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 12 Dec 2016 22:14:11 +0000 (17:14 -0500)
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

index 1d677f74f1f8e3aeacb1024e5835204300e7266f..c50f7604fbc7484a4276af4e249d654b898ef812 100644 (file)
@@ -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)