[libvirt PATCH v2 09/10] qemuMonitorGetMemoryDeviceInfo: Use automatic memory management

Tim Wiederhake posted 10 patches 4 years, 7 months ago
[libvirt PATCH v2 09/10] qemuMonitorGetMemoryDeviceInfo: Use automatic memory management
Posted by Tim Wiederhake 4 years, 7 months ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/qemu/qemu_monitor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 9b1a3ec3eb..0b5da8b71f 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4214,7 +4214,7 @@ int
 qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
                                GHashTable **info)
 {
-    GHashTable *hash;
+    g_autoptr(GHashTable) hash = NULL;
     int ret;
 
     VIR_DEBUG("info=%p", info);
@@ -4229,7 +4229,6 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
     if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, hash)) >= 0)
         *info = g_steal_pointer(&hash);
 
-    virHashFree(hash);
     return ret;
 }
 
-- 
2.31.1

Re: [libvirt PATCH v2 09/10] qemuMonitorGetMemoryDeviceInfo: Use automatic memory management
Posted by Peter Krempa 4 years, 7 months ago
On Tue, Jul 13, 2021 at 17:12:11 +0200, Tim Wiederhake wrote:
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>  src/qemu/qemu_monitor.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>