]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: agent: use g_auto in qemuAgentGetInterfaces
authorJán Tomko <jtomko@redhat.com>
Mon, 5 Oct 2020 20:04:34 +0000 (22:04 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 09:16:08 +0000 (11:16 +0200)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
src/qemu/qemu_agent.c

index e7ea03f8402ef5ee5a5d79de5197345a24226076..39c955fdf1544142a63e13b434a79be1152fa2ad 100644 (file)
@@ -2216,12 +2216,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);
@@ -2250,9 +2250,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
     ret = ifaces_count;
 
  cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    virHashFree(ifaces_store);
     return ret;
 
  error: