[PATCH 04/23] virNWFilterDoInstantiate: Automatically free temporary GHashTable

Peter Krempa posted 23 patches 4 years, 2 months ago
[PATCH 04/23] virNWFilterDoInstantiate: Automatically free temporary GHashTable
Posted by Peter Krempa 4 years, 2 months ago
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/nwfilter/nwfilter_gentech_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index ecba16d55c..55c7571ea5 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -493,8 +493,7 @@ virNWFilterDoInstantiate(virNWFilterTechDriver *techdriver,
     virNWFilterVarValue *lv;
     const char *learning;
     bool reportIP = false;
-
-    GHashTable *missing_vars = virHashNew(virNWFilterVarValueHashFree);
+    g_autoptr(GHashTable) missing_vars = virHashNew(virNWFilterVarValueHashFree);

     memset(&inst, 0, sizeof(inst));

@@ -593,7 +592,6 @@ virNWFilterDoInstantiate(virNWFilterTechDriver *techdriver,

  error:
     virNWFilterInstReset(&inst);
-    virHashFree(missing_vars);

     return rc;

-- 
2.31.1

Re: [PATCH 04/23] virNWFilterDoInstantiate: Automatically free temporary GHashTable
Posted by Ján Tomko 4 years, 2 months ago
On a Tuesday in 2021, Peter Krempa wrote:
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/nwfilter/nwfilter_gentech_driver.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano