[libvirt] [PATCH 1/2] Revert "nwfilter: Fix possible segfault on sometimes consumed variable"

John Ferlan jferlan at redhat.com
Thu Sep 28 19:26:48 UTC 2017


This reverts commit 6209bb32e5b6d8c15d55422bb4716b3b31c1c7b2.

This turns out to be the wrong adjustment

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/nwfilter_ipaddrmap.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/conf/nwfilter_ipaddrmap.c b/src/conf/nwfilter_ipaddrmap.c
index 5668f366d..9c8584ce2 100644
--- a/src/conf/nwfilter_ipaddrmap.c
+++ b/src/conf/nwfilter_ipaddrmap.c
@@ -26,9 +26,7 @@
 
 #include "internal.h"
 
-#include "viralloc.h"
 #include "virerror.h"
-#include "virstring.h"
 #include "datatypes.h"
 #include "nwfilter_params.h"
 #include "nwfilter_ipaddrmap.h"
@@ -54,7 +52,6 @@ virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *addr)
 {
     int ret = -1;
     virNWFilterVarValuePtr val;
-    char *tmp = NULL;
 
     virMutexLock(&ipAddressMapLock);
 
@@ -68,18 +65,14 @@ virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *addr)
             virNWFilterVarValueFree(val);
         goto cleanup;
     } else {
-        if (VIR_STRDUP(tmp, addr) < 0)
+        if (virNWFilterVarValueAddValue(val, addr) < 0)
             goto cleanup;
-        if (virNWFilterVarValueAddValue(val, tmp) < 0)
-            goto cleanup;
-        tmp = NULL;
     }
 
     ret = 0;
 
  cleanup:
     virMutexUnlock(&ipAddressMapLock);
-    VIR_FREE(tmp);
 
     return ret;
 }
-- 
2.13.5




More information about the libvir-list mailing list