]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: agent: remove impossible errors
authorJán Tomko <jtomko@redhat.com>
Mon, 5 Oct 2020 19:21:07 +0000 (21:21 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 09:16:07 +0000 (11:16 +0200)
For both 'ip_addr_arr' and 'ret_array', we:
1) already checked that they are arrays
2) only iterate up to the array size

Remove the duplicate checks.

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 fc7b65de2a2409b4eceb8d418943d98bd56c6e17..51c597f57e0ae128471169a5da7ea95df76101d1 100644 (file)
@@ -2160,13 +2160,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
         const char *hwaddr, *ifname_s, *name = NULL;
         virDomainInterfacePtr iface = NULL;
 
-        /* Shouldn't happen but doesn't hurt to check neither */
-        if (!tmp_iface) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("qemu agent reply missing interface entry in array"));
-            goto error;
-        }
-
         /* interface name is required to be presented */
         name = virJSONValueObjectGetString(tmp_iface, "name");
         if (!name) {
@@ -2229,13 +2222,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
 
             ip_addr = &iface->addrs[addrs_count - 1];
 
-            /* Shouldn't happen but doesn't hurt to check neither */
-            if (!ip_addr_obj) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("qemu agent reply missing IP addr in array"));
-                goto error;
-            }
-
             if (qemuAgentGetInterfaceOneAddress(ip_addr, ip_addr_obj, name) < 0)
                 goto error;
         }