Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/qemu/qemu_monitor.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index a2df1a6ec3..9b1a3ec3eb 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4214,6 +4214,7 @@ int
qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
GHashTable **info)
{
+ GHashTable *hash;
int ret;
VIR_DEBUG("info=%p", info);
@@ -4222,14 +4223,13 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
QEMU_CHECK_MONITOR(mon);
- if (!(*info = virHashNew(g_free)))
+ if (!(hash = virHashNew(g_free)))
return -1;
- if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, *info)) < 0) {
- virHashFree(*info);
- *info = NULL;
- }
+ if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, hash)) >= 0)
+ *info = g_steal_pointer(&hash);
+ virHashFree(hash);
return ret;
}
--
2.31.1