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

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

index 3070c1e6b3d00c79d369a00f1f470f072e47eeb5..d808c4b55b60fee1d6e1e87a0dca0b31069d28cf 100644 (file)
@@ -8405,9 +8405,8 @@ int
 qemuMonitorJSONMigrateIncoming(qemuMonitorPtr mon,
                                const char *uri)
 {
-    int ret = -1;
-    virJSONValuePtr cmd;
-    virJSONValuePtr reply = NULL;
+    g_autoptr(virJSONValue) cmd = NULL;
+    g_autoptr(virJSONValue) reply = NULL;
 
     if (!(cmd = qemuMonitorJSONMakeCommand("migrate-incoming",
                                            "s:uri", uri,
@@ -8415,14 +8414,9 @@ qemuMonitorJSONMigrateIncoming(qemuMonitorPtr mon,
         return -1;
 
     if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    ret = qemuMonitorJSONCheckError(cmd, reply);
+        return -1;
 
- cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return ret;
+    return qemuMonitorJSONCheckError(cmd, reply);
 }