From e0c693387f67022508754ce1fdae6cf47db0478d Mon Sep 17 00:00:00 2001 From: Martin Blapp Date: Sat, 9 Sep 2006 22:14:42 +0000 Subject: [PATCH] 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 --- lib/libc/rpc/clnt_bcast.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libc/rpc/clnt_bcast.c b/lib/libc/rpc/clnt_bcast.c index 5c48cf874b7..eef0ca59a02 100644 --- a/lib/libc/rpc/clnt_bcast.c +++ b/lib/libc/rpc/clnt_bcast.c @@ -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) {