Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/qemu/qemu_monitor.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index d24531832b..6ff7302360 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2155,26 +2155,22 @@ qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon,
bool backingChain)
{
int ret;
- GHashTable *stats = NULL;
+ g_autoptr(GHashTable) stats = NULL;
+
VIR_DEBUG("ret_stats=%p, backing=%d", ret_stats, backingChain);
QEMU_CHECK_MONITOR(mon);
if (!(stats = virHashNew(g_free)))
- goto error;
+ return -1;
ret = qemuMonitorJSONGetAllBlockStatsInfo(mon, stats, backingChain);
if (ret < 0)
- goto error;
+ return -1;
- *ret_stats = stats;
+ *ret_stats = g_steal_pointer(&stats);
return ret;
-
- error:
- virHashFree(stats);
- *ret_stats = NULL;
- return -1;
}
--
2.31.1