qemuRefreshPRManagerState: 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 b59430d107
commit 6e9ddad43b

View File

@ -2291,25 +2291,22 @@ qemuRefreshPRManagerState(virQEMUDriver *driver,
virDomainObj *vm)
{
qemuDomainObjPrivate *priv = vm->privateData;
GHashTable *info = NULL;
int ret = -1;
g_autoptr(GHashTable) info = NULL;
int rc;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER) ||
!qemuDomainDefHasManagedPR(vm))
return 0;
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorGetPRManagerInfo(priv->mon, &info);
rc = qemuMonitorGetPRManagerInfo(priv->mon, &info);
qemuDomainObjExitMonitor(driver, vm);
if (ret < 0)
goto cleanup;
if (rc < 0)
return -1;
ret = qemuProcessRefreshPRManagerState(vm, info);
cleanup:
virHashFree(info);
return ret;
return qemuProcessRefreshPRManagerState(vm, info);
}