[PATCH 6/9] domain_conf: rewrite virDomainSoundCodecDefFree()

Daniel P. Berrangé berrange at redhat.com
Wed Jul 20 13:36:16 UTC 2022


On Wed, Jul 20, 2022 at 03:11:09PM +0200, Kristina Hanicova wrote:
> Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
> ---
>  src/conf/domain_conf.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index f51476c968..88d50d27f5 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2955,10 +2955,8 @@ void virDomainSmartcardDefFree(virDomainSmartcardDef *def)
>  
>  void virDomainSoundCodecDefFree(virDomainSoundCodecDef *def)
>  {
> -    if (!def)
> -        return;
> -
> -    g_free(def);
> +    if (def)
> +        g_free(def);
>  }

This is not desirable - our default pattern for Free() funcs is
to return immediately if NULL. At a later date other statements
may end up being added in the middle of this existing function,
which would involve then reverting this proposed change.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the libvir-list mailing list