From: Peter Krempa Date: Tue, 30 Nov 2021 10:49:24 +0000 (+0100) Subject: qemuRefreshVirtioChannelState: Automatically free GHashTable and refactor cleanup X-Git-Tag: v8.0.0-rc1~421 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b59430d107f40760f7a121f5d0d4444734ee4ffe;p=thirdparty%2Flibvirt.git qemuRefreshVirtioChannelState: Automatically free GHashTable and refactor cleanup Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko Reviewed-by: Martin Kletzander --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e1b5e68237..a68a9d8230 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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; }