]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONSetWatchdogAction: Use automatic memory clearing
authorPeter Krempa <pkrempa@redhat.com>
Fri, 20 Aug 2021 12:09:14 +0000 (14:09 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 25 Aug 2021 13:32:43 +0000 (15:32 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_monitor_json.c

index 8e5af9f79a9ed08bca198e3151c16c157992cd75..8fb2bf4dc3ea56fba74c5ef4a572ed9f6acc3c4e 100644 (file)
@@ -8560,9 +8560,8 @@ int
 qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon,
                                  const char *action)
 {
-    virJSONValue *cmd;
-    virJSONValue *reply = NULL;
-    int ret = -1;
+    g_autoptr(virJSONValue) cmd = NULL;
+    g_autoptr(virJSONValue) reply = NULL;
 
     if (!(cmd = qemuMonitorJSONMakeCommand("watchdog-set-action",
                                            "s:action", action,
@@ -8570,17 +8569,12 @@ qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon,
         return -1;
 
     if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
+        return -1;
 
     if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;
 
- cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return ret;
+    return 0;
 }