From ef6d71f01138b7dd04ea5d58b510bfe4e0296a4f Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 18 Jan 2016 03:52:44 +0000 Subject: [PATCH] MFstable/10 r294240: MFC r293705: Similar to r293704, fix theoretical leak of netconfig(3) resources in __rpcbind_is_up(..) if getnetconfig(3) is partly successful in allocating resources, but not completely successful by moving the endnetconfig(3) call up before we return from the function if nconf == NULL. Submitted by: Miles Ohlrich git-svn-id: svn://svn.freebsd.org/base/stable/9@294242 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libc/rpc/rpcb_clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c index 943d7c899..117ee0f00 100644 --- a/lib/libc/rpc/rpcb_clnt.c +++ b/lib/libc/rpc/rpcb_clnt.c @@ -675,11 +675,11 @@ __rpcbind_is_up() strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0) break; } + endnetconfig(localhandle); + if (nconf == NULL) return (FALSE); - endnetconfig(localhandle); - memset(&sun, 0, sizeof sun); sock = _socket(AF_LOCAL, SOCK_STREAM, 0); if (sock < 0) -- 2.45.0