[PATCH] nwfilter: Initialize virNWFilterAddIpAddrForIfname return variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Latest nwfilter patch ad6c67cf introduced uninitialized return
value. This was spotted by 4.6.2 gcc.
---
 src/nwfilter/nwfilter_learnipaddr.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 675ef5b..2e373a6 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -323,7 +323,7 @@ virNWFilterDeregisterLearnReq(int ifindex) {
 static int
 virNWFilterAddIpAddrForIfname(const char *ifname, char *addr)
 {
-    int ret;
+    int ret = -1;
     virNWFilterVarValuePtr val;
 
     virMutexLock(&ipAddressMapLock);
@@ -333,16 +333,18 @@ virNWFilterAddIpAddrForIfname(const char *ifname, char *addr)
         val = virNWFilterVarValueCreateSimple(addr);
         if (!val) {
             virReportOOMError();
-            ret = -1;
-            goto err_exit;
+            goto cleanup;
         }
         ret = virNWFilterHashTablePut(ipAddressMap, ifname, val, 1);
+        goto cleanup;
     } else {
         if (virNWFilterVarValueAddValue(val, addr) < 0)
-            ret = -1;
+            goto cleanup;
     }
 
-err_exit:
+    ret = 0;
+
+cleanup:
     virMutexUnlock(&ipAddressMapLock);
 
     return ret;
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]