[libvirt PATCH v2 06/10] iptablesPrivateChainCreate: Use automatic memory management

Tim Wiederhake twiederh at redhat.com
Tue Jul 13 15:12:08 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/viriptables.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/util/viriptables.c b/src/util/viriptables.c
index 198ece3d71..847af9b9d7 100644
--- a/src/util/viriptables.c
+++ b/src/util/viriptables.c
@@ -70,8 +70,8 @@ iptablesPrivateChainCreate(virFirewall *fw,
                            void *opaque)
 {
     iptablesGlobalChainData *data = opaque;
-    GHashTable *chains = virHashNew(NULL);
-    GHashTable *links = virHashNew(NULL);
+    g_autoptr(GHashTable) chains = virHashNew(NULL);
+    g_autoptr(GHashTable) links = virHashNew(NULL);
     const char *const *tmp;
     int ret = -1;
     size_t i;
@@ -114,8 +114,6 @@ iptablesPrivateChainCreate(virFirewall *fw,
 
     ret = 0;
  cleanup:
-    virHashFree(chains);
-    virHashFree(links);
     return ret;
 }
 
-- 
2.31.1




More information about the libvir-list mailing list