qemuRefreshVirtioChannelState: Automatically free GHashTable and refactor cleanup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Peter Krempa 2021-11-30 11:49:24 +01:00
parent 54a975ded6
commit b59430d107

View File

@ -2243,24 +2243,21 @@ qemuRefreshVirtioChannelState(virQEMUDriver *driver,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivate *priv = vm->privateData;
GHashTable *info = NULL;
int ret = -1;
g_autoptr(GHashTable) info = NULL;
int rc;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
return -1;
ret = qemuMonitorGetChardevInfo(priv->mon, &info);
rc = qemuMonitorGetChardevInfo(priv->mon, &info);
qemuDomainObjExitMonitor(driver, vm);
if (ret < 0)
goto cleanup;
if (rc < 0)
return -1;
qemuProcessRefreshChannelVirtioState(driver, vm, info, false);
ret = 0;
cleanup:
virHashFree(info);
return ret;
return 0;
}