]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_driver.c: modernize qemuDomainMigratePrepare3()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 13 Jul 2020 09:49:37 +0000 (06:49 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 13 Jul 2020 15:17:40 +0000 (17:17 +0200)
Use g_autoptr() on pointers and remove the unneeded 'cleanup'
label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c

index 6b47e28e99b3cddf307ea4c451fca34f6aab90d3..4fe122f8aefa282caaa8b9ab251b669c8fe07c34 100644 (file)
@@ -12397,10 +12397,9 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
                           const char *dom_xml)
 {
     virQEMUDriverPtr driver = dconn->privateData;
-    virDomainDefPtr def = NULL;
+    g_autoptr(virDomainDef) def = NULL;
     g_autofree char *origname = NULL;
-    qemuMigrationParamsPtr migParams = NULL;
-    int ret = -1;
+    g_autoptr(qemuMigrationParams) migParams = NULL;
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
 
@@ -12411,30 +12410,25 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Tunnelled migration requested but invalid "
                          "RPC method called"));
-        goto cleanup;
+        return -1;
     }
 
     if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
                                                    QEMU_MIGRATION_DESTINATION)))
-        goto cleanup;
+        return -1;
 
     if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
-        goto cleanup;
+        return -1;
 
     if (virDomainMigratePrepare3EnsureACL(dconn, def) < 0)
-        goto cleanup;
-
-    ret = qemuMigrationDstPrepareDirect(driver, dconn,
-                                        cookiein, cookieinlen,
-                                        cookieout, cookieoutlen,
-                                        uri_in, uri_out,
-                                        &def, origname, NULL, 0, NULL, 0,
-                                        migParams, flags);
+        return -1;
 
- cleanup:
-    qemuMigrationParamsFree(migParams);
-    virDomainDefFree(def);
-    return ret;
+    return qemuMigrationDstPrepareDirect(driver, dconn,
+                                         cookiein, cookieinlen,
+                                         cookieout, cookieoutlen,
+                                         uri_in, uri_out,
+                                         &def, origname, NULL, 0, NULL, 0,
+                                         migParams, flags);
 }
 
 static int