[libvirt PATCH 11/14] qemu: agent: use g_auto in qemuAgentGetInterfaces

Ján Tomko jtomko at redhat.com
Tue Oct 6 06:58:47 UTC 2020


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/qemu/qemu_agent.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 8cd1aa6cb0..847300c86e 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2197,12 +2197,12 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
 {
     int ret = -1;
     size_t i;
-    virJSONValuePtr cmd = NULL;
-    virJSONValuePtr reply = NULL;
+    g_autoptr(virJSONValue) cmd = NULL;
+    g_autoptr(virJSONValue) reply = NULL;
     virJSONValuePtr ret_array = NULL;
     size_t ifaces_count = 0;
     virDomainInterfacePtr *ifaces_ret = NULL;
-    virHashTablePtr ifaces_store = NULL;
+    g_autoptr(virHashTable) ifaces_store = NULL;
 
     /* Hash table to handle the interface alias */
     ifaces_store = virHashNew(NULL);
@@ -2232,9 +2232,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
     ret = ifaces_count;
 
  cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    virHashFree(ifaces_store);
     return ret;
 
  error:
-- 
2.26.2




More information about the libvir-list mailing list