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

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

 




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@xxxxxxxxxxxxx>
> ---
>  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)?

John

>          protection = VIR_MIGRATE_CHANGE_PROTECTION;
>  
>      VIR_DEBUG("Begin3 %p", domain->conn);
> @@ -3403,6 +3420,8 @@ virDomainMigrateUnmanagedParams(virDomainPtr domain,

[...]




[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