[PATCH v3 1/4] src: adopt to VIR_DRV_SUPPORTS_FEATURE return -1

Michal Privoznik mprivozn at redhat.com
Thu Jan 7 12:00:51 UTC 2021


On 1/7/21 12:53 PM, John Ferlan wrote:
> 
> 
> On 12/18/20 1:56 AM, Nikolay Shirokovskiy wrote:
>> Otherwise in some places we can mistakenly report 'unsupported' error instead
>> of root cause. So let's handle root cause explicitly from the macro.
>>
>> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
>> ---
>>   src/libvirt-domain.c | 511 ++++++++++++++++++++++++++++++++++-----------------
>>   src/libvirt-host.c   |  18 +-
>>   src/libvirt.c        |   7 +-
>>   3 files changed, 365 insertions(+), 171 deletions(-)
>>
> 
> [...]
> 
>> @@ -3005,8 +3019,11 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
>>           return NULL;
>>       params = tmp;
>>   
>> -    if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
>> -                                 VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION))
>> +    ret = VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
>> +                                   VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION);
>> +    if (ret < 0)
>> +        return NULL;
>> +    if (ret)
> 
> Coverity complains this is a RESOURCE_LEAK for @tmp (or essentially @params)
> 
> Perhaps the hunk for VIR_DRV_SUPPORTS_FEATURE should go before
> virTypedParamsCopy or use goto done (similar if !dom_xml)?
> 

Yes, reorder looks good.

Michal




More information about the libvir-list mailing list