[...]
> int
> qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
> virDomainDefPtr vmdef)
> +{
> + int ret = -1;
> + qemuAgentFSInfoPtr *agentinfo = NULL;
> + virDomainFSInfoPtr *info_ret = NULL;
> + size_t i;
> + int nfs;
> +
> + nfs = qemuAgentGetFSInfoInternal(mon, &agentinfo, vmdef);
> + if (nfs < 0)
> + return ret;
> + if (VIR_ALLOC_N(info_ret, nfs) < 0)
> + goto cleanup;
> +
> + for (i = 0; i < nfs; i++) {
> + if (!(info_ret[i] = qemuAgentFSInfoToPublic(agentinfo[i])))
> + goto cleanup;
> + }
> +
> + *info = info_ret;
> + info_ret = NULL;
> + ret = nfs;
> +
> + cleanup:
> + for (i = 0; i < nfs; i++) {
> + qemuAgentFSInfoFree(agentinfo[i]);
> + /* if there was an error, free any memory we've allocated for
> the
> + * return value */
> + if (info_ret)
> + virDomainFSInfoFree(info_ret[i]);
Dont' forget to free @info_ret itself.
Seems this review comment was missed/forgotten as my Coverity checker
triggered yesterday (just didn't get to it until today)... Although
there was an addition of a VIR_FREE on @agentinfo.
John
> + }
> + return ret;
> +}
> +
> +
[...]