From 728878b7d7d47d22224013c41e3638b0b2e11332 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 11 Jan 2016 22:01:33 +0000 Subject: 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. MFC after: 1 week Reported by: Coverity Submitted by: Miles Ohlrich Sponsored by: EMC / Isilon Storage Division --- lib/libc/rpc/rpcb_clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c index 49300ed..8477505 100644 --- a/lib/libc/rpc/rpcb_clnt.c +++ b/lib/libc/rpc/rpcb_clnt.c @@ -661,11 +661,11 @@ __rpcbind_is_up(void) 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) -- cgit v1.1