Fix two file descriptor leaks in the internal function local_rpcb()
that is used by a number of rpcbind-related library functions. Also fix a rpc client leak in rpcb_set(). Submitted by: mbr Obtained from: NetBSD
This commit is contained in:
parent
8c1dde21a3
commit
6112fceebd
@ -459,8 +459,14 @@ local_rpcb()
|
||||
client = clnt_vc_create(sock, &nbuf, (rpcprog_t)RPCBPROG,
|
||||
(rpcvers_t)RPCBVERS, tsize, tsize);
|
||||
|
||||
if (client != NULL)
|
||||
if (client != NULL) {
|
||||
/* Mark the socket to be closed in destructor */
|
||||
(void) CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL);
|
||||
return client;
|
||||
}
|
||||
|
||||
/* Nobody needs this socket anymore; free the descriptor. */
|
||||
_close(sock);
|
||||
|
||||
try_nconf:
|
||||
|
||||
@ -552,6 +558,7 @@ rpcb_set(program, version, nconf, address)
|
||||
parms.r_addr = taddr2uaddr((struct netconfig *) nconf,
|
||||
(struct netbuf *)address);
|
||||
if (!parms.r_addr) {
|
||||
CLNT_DESTROY(client);
|
||||
rpc_createerr.cf_stat = RPC_N2AXLATEFAILURE;
|
||||
return (FALSE); /* no universal address */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user