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

Peter Krempa pkrempa at redhat.com
Thu Oct 12 19:07:32 UTC 2017


Use VIR_STEAL_PTR to remove conditional cleanup.
---
 src/conf/domain_conf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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;
-- 
2.14.1




More information about the libvir-list mailing list