mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 11:01:19 +00:00
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:
parent
aad764e107
commit
489e14f258
@ -323,7 +323,7 @@ virNWFilterDeregisterLearnReq(int ifindex) {
|
|||||||
static int
|
static int
|
||||||
virNWFilterAddIpAddrForIfname(const char *ifname, char *addr)
|
virNWFilterAddIpAddrForIfname(const char *ifname, char *addr)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = -1;
|
||||||
virNWFilterVarValuePtr val;
|
virNWFilterVarValuePtr val;
|
||||||
|
|
||||||
virMutexLock(&ipAddressMapLock);
|
virMutexLock(&ipAddressMapLock);
|
||||||
@ -333,17 +333,21 @@ virNWFilterAddIpAddrForIfname(const char *ifname, char *addr)
|
|||||||
val = virNWFilterVarValueCreateSimple(addr);
|
val = virNWFilterVarValueCreateSimple(addr);
|
||||||
if (!val) {
|
if (!val) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
goto err_exit;
|
|
||||||
}
|
}
|
||||||
ret = virNWFilterHashTablePut(ipAddressMap, ifname, val, 1);
|
ret = virNWFilterHashTablePut(ipAddressMap, ifname, val, 1);
|
||||||
|
/* FIXME: fix when return code of virNWFilterHashTablePut changes */
|
||||||
|
if (ret)
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
if (virNWFilterVarValueAddValue(val, addr) < 0)
|
if (virNWFilterVarValueAddValue(val, addr) < 0)
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
ret = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err_exit:
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
virMutexUnlock(&ipAddressMapLock);
|
virMutexUnlock(&ipAddressMapLock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user