]> xenbits.xensource.com Git - libvirt.git/commitdiff
Revert "nwfilter: Fix possible segfault on sometimes consumed variable"
authorJohn Ferlan <jferlan@redhat.com>
Thu, 28 Sep 2017 19:13:46 +0000 (15:13 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 2 Oct 2017 10:14:32 +0000 (06:14 -0400)
This reverts commit 6209bb32e5b6d8c15d55422bb4716b3b31c1c7b2.

This turns out to be the wrong adjustment

src/conf/nwfilter_ipaddrmap.c

index 5668f366d8f4cd6aba08c98f721bb549fc64b458..9c8584ce27c953d535eb005682014dcb5f7a5474 100644 (file)
@@ -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;
 }