Re: [PATCH v3 6/9] qemu: add support for new fields in FSInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[...]

> 
>>   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;
>> +}
>> +
>> +

[...]

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux