[PATCH 05/23] virNWFilterBuildAll: Automatically free temporary GHashTable

Peter Krempa pkrempa at redhat.com
Tue Nov 30 14:31:49 UTC 2021


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/nwfilter/nwfilter_gentech_driver.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 55c7571ea5..ea1f4f4092 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -979,7 +979,8 @@ virNWFilterBuildAll(virNWFilterDriverState *driver,
     VIR_DEBUG("Build all filters newFilters=%d", newFilters);

     if (newFilters) {
-        data.skipInterfaces = virHashNew(NULL);
+        g_autoptr(GHashTable) skipInterfaces = virHashNew(NULL);
+        data.skipInterfaces = skipInterfaces;

         data.step = STEP_APPLY_NEW;
         if (virNWFilterBindingObjListForEach(driver->bindings,
@@ -998,8 +999,6 @@ virNWFilterBuildAll(virNWFilterDriverState *driver,
                                              virNWFilterBuildIter,
                                              &data);
         }
-
-        virHashFree(data.skipInterfaces);
     } else {
         data.step = STEP_APPLY_CURRENT;
         if (virNWFilterBindingObjListForEach(driver->bindings,
-- 
2.31.1




More information about the libvir-list mailing list