]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONHumanCommand: Require @reply_str
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 22 Oct 2021 08:08:35 +0000 (10:08 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Oct 2021 11:42:14 +0000 (13:42 +0200)
All callers of qemuMonitorJSONHumanCommand() pass a non-NULL pointer
as @reply_str therefore there's no need to check whether it is NULL.
NB, the sister function (qemuMonitorJSONArbitraryCommand()) doesn't
check for NULL either.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
src/qemu/qemu_monitor_json.c

index 6d8ccd91e89eee866dc01f924e886e42bd0f7009..7833038a0666b6a73e1832bc4ca4091f6c7c2d22 100644 (file)
@@ -1470,6 +1470,7 @@ qemuMonitorJSONHumanCommand(qemuMonitor *mon,
     virJSONValue *cmd = NULL;
     virJSONValue *reply = NULL;
     virJSONValue *obj;
+    const char *data;
     int ret = -1;
 
     cmd = qemuMonitorJSONMakeCommand("human-monitor-command",
@@ -1490,13 +1491,8 @@ qemuMonitorJSONHumanCommand(qemuMonitor *mon,
         goto cleanup;
 
     obj = virJSONValueObjectGet(reply, "return");
-
-    if (reply_str) {
-        const char *data;
-
-        data = virJSONValueGetString(obj);
-        *reply_str = g_strdup(NULLSTR_EMPTY(data));
-    }
+    data = virJSONValueGetString(obj);
+    *reply_str = g_strdup(NULLSTR_EMPTY(data));
 
     ret = 0;