[libvirt PATCH 08/10] qemuMonitorGetMemoryDeviceInfo: Assign hash table only on success

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux