[PATCH] qemu_checkpoint.c: Use g_autofree in qemuCheckpointPrepare()

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

 



This is the only instance of g_autofree change applicable for
qemu_checkpoint.c

Signed-off-by: Seeteena Thoufeek <s1seetee@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_checkpoint.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
index 3a510c9..ccd10cb 100644
--- a/src/qemu/qemu_checkpoint.c
+++ b/src/qemu/qemu_checkpoint.c
@@ -405,9 +405,8 @@ qemuCheckpointPrepare(virQEMUDriverPtr driver,
                       virDomainObjPtr vm,
                       virDomainCheckpointDefPtr def)
 {
-    int ret = -1;
     size_t i;
-    char *xml = NULL;
+    g_autofree char *xml = NULL;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
     /* Easiest way to clone inactive portion of vm->def is via
@@ -419,10 +418,10 @@ qemuCheckpointPrepare(virQEMUDriverPtr driver,
                                                     priv->qemuCaps,
                                                     VIR_DOMAIN_DEF_PARSE_INACTIVE |
                                                     VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
-        goto cleanup;
+        return -1;
 
     if (virDomainCheckpointAlignDisks(def) < 0)
-        goto cleanup;
+        return -1;
 
     for (i = 0; i < def->ndisks; i++) {
         virDomainCheckpointDiskDefPtr disk = &def->disks[i];
@@ -434,7 +433,7 @@ qemuCheckpointPrepare(virQEMUDriverPtr driver,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("bitmap for disk '%s' must match checkpoint name '%s'"),
                            disk->name, def->parent.name);
-            goto cleanup;
+            return -1;
         }
 
         if (vm->def->disks[i]->src->format != VIR_STORAGE_FILE_QCOW2) {
@@ -444,15 +443,11 @@ qemuCheckpointPrepare(virQEMUDriverPtr driver,
                            disk->name,
                            virStorageFileFormatTypeToString(
                                vm->def->disks[i]->src->format));
-            goto cleanup;
+            return -1;
         }
     }
 
-    ret = 0;
-
- cleanup:
-    VIR_FREE(xml);
-    return ret;
+    return 0;
 }
 
 static int
-- 
1.8.3.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