Signed-off-by: Tim Wiederhake <twied...@redhat.com>
---
 src/qemu/qemu_monitor.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 8f35b4240f..8646efe9c4 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4238,6 +4238,7 @@ int
 qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
                                GHashTable **info)
 {
+    GHashTable *hash;
     int ret;
 
     VIR_DEBUG("info=%p", info);
@@ -4246,14 +4247,14 @@ 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) {
+        virHashFree(hash);
     }
 
+    *info = hash;
     return ret;
 }
 
-- 
2.31.1

Reply via email to