qemu: agent: remove cleanup in qemuAgentGetInterfaces

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Ján Tomko 2020-10-05 22:05:55 +02:00
parent 00311ef603
commit ddc2e51767

View 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;
}