mirror of https://gitee.com/openkylin/libvirt.git
networkGetNetworkAddress: Drop empty 'error' label
Moreover, there are two points within the function, where we're missing 'goto cleanup'. Fix this too. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
77ea6f7b0b
commit
5c6b8226f3
|
@ -4562,7 +4562,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||||
virReportError(VIR_ERR_NO_NETWORK,
|
virReportError(VIR_ERR_NO_NETWORK,
|
||||||
_("no network with matching name '%s'"),
|
_("no network with matching name '%s'"),
|
||||||
netname);
|
netname);
|
||||||
goto error;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
netdef = network->def;
|
netdef = network->def;
|
||||||
|
|
||||||
|
@ -4576,7 +4576,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("network '%s' doesn't have an IPv4 address"),
|
_("network '%s' doesn't have an IPv4 address"),
|
||||||
netdef->name);
|
netdef->name);
|
||||||
break;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
addrptr = &ipdef->address;
|
addrptr = &ipdef->address;
|
||||||
break;
|
break;
|
||||||
|
@ -4598,19 +4598,20 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("network '%s' has no associated interface or bridge"),
|
_("network '%s' has no associated interface or bridge"),
|
||||||
netdef->name);
|
netdef->name);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev_name) {
|
if (dev_name) {
|
||||||
if (virNetDevGetIPv4Address(dev_name, &addr) < 0)
|
if (virNetDevGetIPv4Address(dev_name, &addr) < 0)
|
||||||
goto error;
|
goto cleanup;
|
||||||
addrptr = &addr;
|
addrptr = &addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(addrptr &&
|
if (!(addrptr &&
|
||||||
(*netaddr = virSocketAddrFormat(addrptr)))) {
|
(*netaddr = virSocketAddrFormat(addrptr)))) {
|
||||||
goto error;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -4618,9 +4619,6 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||||
if (network)
|
if (network)
|
||||||
virNetworkObjUnlock(network);
|
virNetworkObjUnlock(network);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
error:
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue