summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-01-11 22:01:33 +0000
committerngie <ngie@FreeBSD.org>2016-01-11 22:01:33 +0000
commit728878b7d7d47d22224013c41e3638b0b2e11332 (patch)
treedd9b5733a7bcdbd18034427dadced14224dca611 /lib
parentcf1ded0c14305d1beb8f684c5c2af13f5199a13e (diff)
downloadFreeBSD-src-728878b7d7d47d22224013c41e3638b0b2e11332.zip
FreeBSD-src-728878b7d7d47d22224013c41e3638b0b2e11332.tar.gz
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 <miles.ohlrich@isilon.com> Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/rpcb_clnt.c4
1 files changed, 2 insertions, 2 deletions
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)
OpenPOWER on IntegriCloud