diff options
author | ngie <ngie@FreeBSD.org> | 2016-05-22 02:53:17 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-05-22 02:53:17 +0000 |
commit | 526c7b961f0343da8ce288c1f2b3b734cec34ca4 (patch) | |
tree | abef379fcc8c254398452e932552322212fb7ad5 /lib/libc | |
parent | fa649cf616ed2ef8ab203880cac5a6c9727db62c (diff) | |
download | FreeBSD-src-526c7b961f0343da8ce288c1f2b3b734cec34ca4.zip FreeBSD-src-526c7b961f0343da8ce288c1f2b3b734cec34ca4.tar.gz |
Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
was NULL
This would theoretically happen if the netconfig protocol family and protocol
semantics were never matched.
MFC after: 2 weeks
Reported by: Coverity
CID: 978179
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/rpc/rpcb_clnt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c index 8477505..02206a9 100644 --- a/lib/libc/rpc/rpcb_clnt.c +++ b/lib/libc/rpc/rpcb_clnt.c @@ -499,6 +499,7 @@ try_nconf: hostname = IN6_LOCALHOST_STRING; } } + endnetconfig(nc_handle); if (tmpnconf == NULL) { rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; mutex_unlock(&loopnconf_lock); @@ -506,7 +507,6 @@ try_nconf: } loopnconf = getnetconfigent(tmpnconf->nc_netid); /* loopnconf is never freed */ - endnetconfig(nc_handle); } mutex_unlock(&loopnconf_lock); client = getclnthandle(hostname, loopnconf, NULL); |