Re: [PATCH 03/10] conf: Clean up virDomainHostdevDefNew()

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

 



On Thu, Jun 29, 2017 at 20:03:56 +0200, Andrea Bolognani wrote:
> Follow the same style as other similar functions.
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 15dd285..ccd3c27 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2380,25 +2380,26 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
>  virDomainHostdevDefPtr
>  virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt)
>  {
> -    virDomainHostdevDefPtr def = NULL;
> +    virDomainHostdevDefPtr def;
>  
> -    if (VIR_ALLOC(def) < 0 ||
> -        VIR_ALLOC(def->info) < 0) {
> -        VIR_FREE(def);
> +    if (VIR_ALLOC(def) < 0)
>          return NULL;
> -    }
> +
> +    if (VIR_ALLOC(def->info) < 0)
> +        goto error;
>  
>      if (xmlopt &&
>          xmlopt->privateData.hostdevNew &&
>          !(def->privateData = xmlopt->privateData.hostdevNew()))
>          goto error;

Changes below a rather pointless, and nothing gets added to the cleanup
section in other patches.

ACK to changes above this line.

>  
> + cleanup:
>      return def;
>  
>   error:
>      VIR_FREE(def->info);
>      VIR_FREE(def);
> -    return NULL;
> +    goto cleanup;
>  }
>  
>  
> -- 
> 2.7.5
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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