Sync with NetBSD rev. 1.16 + 1.17

Coverity CID 3651: Don't leak ifaddrs on getaddrinfo failure.
Coverity CID 2283: Don't leak sys_auth on error.

MFC after:    1 month
This commit is contained in:
mbr 2006-09-09 22:14:42 +00:00
parent ecd9e77d3e
commit bc9ee76c28

View File

@ -141,8 +141,10 @@ __rpc_getbroadifs(int af, int proto, int socktype, broadlist_t *list)
hints.ai_protocol = proto;
hints.ai_socktype = socktype;
if (getaddrinfo(NULL, "sunrpc", &hints, &res) != 0)
if (getaddrinfo(NULL, "sunrpc", &hints, &res) != 0) {
freeifaddrs(ifp);
return 0;
}
for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) {
if (ifap->ifa_addr->sa_family != af ||
@ -299,6 +301,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
if (nettype == NULL)
nettype = "datagram_n";
if ((handle = __rpc_setconf(nettype)) == NULL) {
AUTH_DESTROY(sys_auth);
return (RPC_UNKNOWNPROTO);
}
while ((nconf = __rpc_getconf(handle)) != NULL) {