Thanks for trying to fix this. This one tries to address Jiri's concern
about the return value from virNWFilterHashTablePut with a not to fix it
in the future.
Latest nwfilter patch ad6c67cf introduced uninitialized return
value. This was spotted by 4.6.2 gcc.
---
src/nwfilter/nwfilter_learnipaddr.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
Index: libvirt-acl/src/nwfilter/nwfilter_learnipaddr.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_learnipaddr.c
+++ libvirt-acl/src/nwfilter/nwfilter_learnipaddr.c
@@ -323,7 +323,7 @@ virNWFilterDeregisterLearnReq(int ifinde
static int
virNWFilterAddIpAddrForIfname(const char *ifname, char *addr)
{
- int ret;
+ int ret = -1;
virNWFilterVarValuePtr val;
virMutexLock(&ipAddressMapLock);
@@ -333,16 +333,21 @@ virNWFilterAddIpAddrForIfname(const char
val = virNWFilterVarValueCreateSimple(addr);
if (!val) {
virReportOOMError();
- ret = -1;
- goto err_exit;
+ goto cleanup;
}
ret = virNWFilterHashTablePut(ipAddressMap, ifname, val, 1);
+ /* FIXME: fix when return code of virNWFilterHashTablePut
changes */
+ if (ret)
+ ret = -1;
+ goto cleanup;
} else {
if (virNWFilterVarValueAddValue(val, addr) < 0)
- ret = -1;
+ goto cleanup;
}
-err_exit:
+ ret = 0;
+
+cleanup:
virMutexUnlock(&ipAddressMapLock);
return ret;
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list