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
This commit is contained in:
Enji Cooper 2016-05-22 02:53:11 +00:00
parent 99d498608a
commit b70cb0694b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300388

View File

@ -499,6 +499,7 @@ local_rpcb(void)
hostname = IN6_LOCALHOST_STRING;
}
}
endnetconfig(nc_handle);
if (tmpnconf == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
mutex_unlock(&loopnconf_lock);
@ -506,7 +507,6 @@ local_rpcb(void)
}
loopnconf = getnetconfigent(tmpnconf->nc_netid);
/* loopnconf is never freed */
endnetconfig(nc_handle);
}
mutex_unlock(&loopnconf_lock);
client = getclnthandle(hostname, loopnconf, NULL);