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

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

index 6953badcfeb9331237a0c51d20256edafb228b8b..6273acd65af8f0bb4e6a72e17b486277b1c2213d 100644 (file)
@@ -1092,28 +1092,23 @@ qemuMigrationParamsFetch(virQEMUDriverPtr driver,
                          qemuMigrationParamsPtr *migParams)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    virJSONValuePtr jsonParams = NULL;
-    int ret = -1;
+    g_autoptr(virJSONValue) jsonParams = NULL;
     int rc;
 
     *migParams = NULL;
 
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
-        goto cleanup;
+        return -1;
 
     rc = qemuMonitorGetMigrationParams(priv->mon, &jsonParams);
 
     if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
-        goto cleanup;
+        return -1;
 
     if (!(*migParams = qemuMigrationParamsFromJSON(jsonParams)))
-        goto cleanup;
-
-    ret = 0;
+        return -1;
 
- cleanup:
-    virJSONValueFree(jsonParams);
-    return ret;
+    return 0;
 }