[libvirt] [PATCH 1/9] conf: domain: Simplify return from backing store parser

Eric Blake eblake at redhat.com
Thu Oct 12 19:12:27 UTC 2017


On 10/12/2017 02:07 PM, Peter Krempa wrote:
> Use VIR_STEAL_PTR to remove conditional cleanup.
> ---
>  src/conf/domain_conf.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Eric Blake <eblake at redhat.com>

> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 54be9028d..f7c9160b4 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8315,12 +8315,11 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
>          virDomainDiskBackingStoreParse(ctxt, backingStore, flags) < 0)
>          goto cleanup;
> 
> -    src->backingStore = backingStore;
> +    VIR_STEAL_PTR(src->backingStore, backingStore);
>      ret = 0;
> 
>   cleanup:
> -    if (ret < 0)
> -        virStorageSourceFree(backingStore);
> +    virStorageSourceFree(backingStore);
>      VIR_FREE(type);
>      VIR_FREE(format);
>      ctxt->node = save_ctxt;
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171012/56b87cc4/attachment-0001.sig>


More information about the libvir-list mailing list