[libvirt PATCH 5/9] ch: use g_auto in virCHMonitorBuildDisksJson

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/ch/ch_monitor.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 174ea47c51..d268dc3c90 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -211,7 +211,7 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, virDomainDiskDef *diskdef)
 static int
 virCHMonitorBuildDisksJson(virJSONValue *content, virDomainDef *vmdef)
 {
-    virJSONValue *disks;
+    g_autoptr(virJSONValue) disks = NULL;
     size_t i;
 
     if (vmdef->ndisks > 0) {
@@ -219,17 +219,13 @@ virCHMonitorBuildDisksJson(virJSONValue *content, virDomainDef *vmdef)
 
         for (i = 0; i < vmdef->ndisks; i++) {
             if (virCHMonitorBuildDiskJson(disks, vmdef->disks[i]) < 0)
-                goto cleanup;
+                return -1;
         }
         if (virJSONValueObjectAppend(content, "disks", &disks) < 0)
-            goto cleanup;
+            return -1;
     }
 
     return 0;
-
- cleanup:
-    virJSONValueFree(disks);
-    return -1;
 }
 
 static int
-- 
2.31.1




[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