[PATCH v3 1/4] src: adopt to VIR_DRV_SUPPORTS_FEATURE return -1
John Ferlan
jferlan at redhat.com
Thu Jan 7 11:53:13 UTC 2021
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)?
John
> protection = VIR_MIGRATE_CHANGE_PROTECTION;
>
> VIR_DEBUG("Begin3 %p", domain->conn);
> @@ -3403,6 +3420,8 @@ virDomainMigrateUnmanagedParams(virDomainPtr domain,
[...]
More information about the libvir-list
mailing list