[libvirt] [PATCH 03/10] conf: Clean up virDomainHostdevDefNew()
Peter Krempa
pkrempa at redhat.com
Fri Jun 30 10:46:11 UTC 2017
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 at redhat.com>
> ---
> 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170630/a6caadd7/attachment-0001.sig>
More information about the libvir-list
mailing list