]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: agent: remove redundant checks
authorJán Tomko <jtomko@redhat.com>
Mon, 5 Oct 2020 20:09:49 +0000 (22:09 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 09:16:07 +0000 (11:16 +0200)
virJSONValueObjectGetArray returns NULL if the object with
the supplied key is not an array.

Calling virJSONValueIsArray right after is redundant.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
src/qemu/qemu_agent.c

index 09116e749cc4a3e2f2289232a2b769bd2acd1267..456f0b69e6c7290ff601aa6d0313589ba27d46dd 100644 (file)
@@ -1444,12 +1444,6 @@ qemuAgentGetVCPUs(qemuAgentPtr agent,
         goto cleanup;
     }
 
-    if (!virJSONValueIsArray(data)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Malformed guest-get-vcpus data array"));
-        goto cleanup;
-    }
-
     ndata = virJSONValueArraySize(data);
 
     *info = g_new0(qemuAgentCPUInfo, ndata);
@@ -2314,12 +2308,6 @@ qemuAgentGetUsers(qemuAgentPtr agent,
         return -1;
     }
 
-    if (!virJSONValueIsArray(data)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Malformed guest-get-users data array"));
-        return -1;
-    }
-
     ndata = virJSONValueArraySize(data);
 
     if (virTypedParamsAddUInt(params, nparams, maxparams,