nwfilter: Initialize virNWFilterAddIpAddrForIfname return variable

Latest nwfilter patch ad6c67cf introduced uninitialized return
value. This was spotted by 4.6.2 gcc.
This commit is contained in:
Michal Privoznik 2011-11-23 07:43:17 -05:00 committed by Stefan Berger
parent aad764e107
commit 489e14f258
1 changed files with 10 additions and 6 deletions

View File

@ -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,17 +333,21 @@ 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);
/* FIXME: fix when return code of virNWFilterHashTablePut changes */
if (ret)
ret = -1;
goto cleanup;
} else {
if (virNWFilterVarValueAddValue(val, addr) < 0)
ret = -1;
ret = 0;
goto cleanup;
}
err_exit:
ret = 0;
cleanup:
virMutexUnlock(&ipAddressMapLock);
return ret;