[PATCH 04/14] util: storagefile: Simplify cleanup in virStorageSourceParseBackingJSON

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

 



Automatically free the 'root' temporary variable to get rid fo some
complexity.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virstoragefile.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index e93f6285b0..6fff013e3a 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -3622,16 +3622,12 @@ static int
 virStorageSourceParseBackingJSON(virStorageSourcePtr src,
                                  const char *json)
 {
-    virJSONValuePtr root = NULL;
-    int ret = -1;
+    VIR_AUTOPTR(virJSONValue) root = NULL;

     if (!(root = virJSONValueFromString(json)))
         return -1;

-    ret = virStorageSourceParseBackingJSONInternal(src, root);
-
-    virJSONValueFree(root);
-    return ret;
+    return virStorageSourceParseBackingJSONInternal(src, root);
 }


-- 
2.21.0

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