[libvirt][PATCH RESEND v12 1/6] Define SGX capabilities structs

Michal Prívozník mprivozn at redhat.com
Mon May 30 13:10:06 UTC 2022


On 5/18/22 09:59, Haibin Huang wrote:
> Signed-off-by: Haibin Huang <haibin.huang at intel.com>
> ---
>  src/conf/domain_capabilities.c | 10 ++++++++++
>  src/conf/domain_capabilities.h | 13 +++++++++++++
>  src/libvirt_private.syms       |  1 +
>  3 files changed, 24 insertions(+)
> 
> diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
> index 2a888da1a9..d0e863c5cb 100644
> --- a/src/conf/domain_capabilities.c
> +++ b/src/conf/domain_capabilities.c
> @@ -78,6 +78,16 @@ virSEVCapabilitiesFree(virSEVCapability *cap)
>  }
>  
>  
> +void
> +virSGXCapabilitiesFree(virSGXCapability *cap)
> +{
> +    if (!cap)
> +        return;
> +
> +    VIR_FREE(cap);

We try to avoid VIR_FREE() in new code. Either use plain g_free() or if
you also need to clear the pointer then: g_clear_pointer(&cap, g_free);
but since only first order pointer is passed then clearing the variable
has no visible effect outside of the function => plain g_free() is
sufficient.

> +}
> +
> +

Michal



More information about the libvir-list mailing list