]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: agent: remove cleanup in qemuAgentGetInterfaces
authorJán Tomko <jtomko@redhat.com>
Mon, 5 Oct 2020 20:05:55 +0000 (22:05 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 09:16:08 +0000 (11:16 +0200)
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 39c955fdf1544142a63e13b434a79be1152fa2ad..06e143b0b919ee0004faa00c631fe72c5ce84b5a 100644 (file)
@@ -2214,7 +2214,6 @@ int
 qemuAgentGetInterfaces(qemuAgentPtr agent,
                        virDomainInterfacePtr **ifaces)
 {
-    int ret = -1;
     size_t i;
     g_autoptr(virJSONValue) cmd = NULL;
     g_autoptr(virJSONValue) reply = NULL;
@@ -2227,15 +2226,15 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
     ifaces_store = virHashNew(NULL);
 
     if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
-        goto cleanup;
+        return -1;
 
     if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0)
-        goto cleanup;
+        return -1;
 
     if (!(ret_array = virJSONValueObjectGetArray(reply, "return"))) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("qemu agent didn't return an array of interfaces"));
-        goto cleanup;
+        return -1;
     }
 
     for (i = 0; i < virJSONValueArraySize(ret_array); i++) {
@@ -2247,10 +2246,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
     }
 
     *ifaces = g_steal_pointer(&ifaces_ret);
-    ret = ifaces_count;
-
- cleanup:
-    return ret;
+    return ifaces_count;
 
  error:
     if (ifaces_ret) {
@@ -2258,7 +2254,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
             virDomainInterfaceFree(ifaces_ret[i]);
     }
     VIR_FREE(ifaces_ret);
-    goto cleanup;
+    return -1;
 }