Moreover, there are two points within the function, where we're
missing 'goto cleanup'. Fix this too.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/network/bridge_driver.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index f2026fb..019cb41 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -4560,7 +4560,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
virReportError(VIR_ERR_NO_NETWORK,
_("no network with matching name '%s'"),
netname);
- goto error;
+ goto cleanup;
}
netdef = network->def;
@@ -4574,7 +4574,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
virReportError(VIR_ERR_INTERNAL_ERROR,
_("network '%s' doesn't have an IPv4
address"),
netdef->name);
- break;
+ goto cleanup;
}
addrptr = &ipdef->address;
break;
@@ -4596,19 +4596,20 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
virReportError(VIR_ERR_INTERNAL_ERROR,
_("network '%s' has no associated interface or
bridge"),
netdef->name);
+ goto cleanup;
}
break;
}
if (dev_name) {
if (virNetDevGetIPv4Address(dev_name, &addr) < 0)
- goto error;
+ goto cleanup;
addrptr = &addr;
}
if (!(addrptr &&
(*netaddr = virSocketAddrFormat(addrptr)))) {
- goto error;
+ goto cleanup;
}
ret = 0;
@@ -4616,9 +4617,6 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
if (network)
virNetworkObjUnlock(network);
return ret;
-
- error:
- goto cleanup;
}
/**
--
2.0.5