From: Nikolay Shirokovskiy Date: Mon, 12 Dec 2016 09:13:42 +0000 (+0300) Subject: qemu: agent: fix uninitialized var case in qemuAgentGetFSInfo X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3ab9652a8679e17fb108ef7a6a6422dfd7149eb1;p=libvirt.git qemu: agent: fix uninitialized var case in qemuAgentGetFSInfo 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. --- diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 1d677f74f1..c50f7604fb 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)