[PATCH v1 07/25] qemu_migration.c: modernize qemuMigrationDstPrepare()

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

 



Use g_autofree and remove the 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_migration.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4ef3245c75..e0077d731b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2306,8 +2306,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm,
                         int fd)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    qemuProcessIncomingDefPtr inc = NULL;
-    char *migrateFrom = NULL;
+    g_autofree char *migrateFrom = NULL;
 
     if (tunnel) {
         migrateFrom = g_strdup("stdio");
@@ -2329,7 +2328,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm,
                 if (!hostIPv6Capable) {
                     virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
                                    _("host isn't capable of IPv6"));
-                    goto cleanup;
+                    return NULL;
                 }
                 /* IPv6 address must be escaped in brackets on the cmd line */
                 encloseAddress = true;
@@ -2358,12 +2357,8 @@ qemuMigrationDstPrepare(virDomainObjPtr vm,
         migrateFrom = g_strdup_printf(incFormat, protocol, listenAddress, port);
     }
 
-    inc = qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress,
-                                    migrateFrom, fd, NULL);
-
- cleanup:
-    VIR_FREE(migrateFrom);
-    return inc;
+    return qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress,
+                                     migrateFrom, fd, NULL);
 }
 
 static int
-- 
2.26.2




[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