From b855a121e272a07bd83ce7b51f776e73d7412cf4 Mon Sep 17 00:00:00 2001 From: iedowse Date: Sat, 14 Jul 2001 18:18:23 +0000 Subject: [PATCH] Fix a memory leak in __rpcb_findaddr(), avoid compiler warnings. Submitted by: Martin Blapp --- lib/libc/rpc/rpcb_clnt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c index 6ad34f394db6..d70aaec589dd 100644 --- a/lib/libc/rpc/rpcb_clnt.c +++ b/lib/libc/rpc/rpcb_clnt.c @@ -298,6 +298,7 @@ getclnthandle(host, nconf, targaddr) /* VARIABLES PROTECTED BY rpcbaddr_cache_lock: ad_cache */ /* Get the address of the rpcbind. Check cache first */ + client = NULL; addr_to_delete.len = 0; rwlock_rdlock(&rpcbaddr_cache_lock); ad_cache = check_cache(host, nconf->nc_netid); @@ -938,6 +939,8 @@ __rpcb_findaddr(program, version, nconf, host, clpp) } else if (client) { CLNT_DESTROY(client); } + if (parms.r_addr != NULL && parms.r_addr != nullstring) + free(parms.r_addr); return (address); } @@ -1056,7 +1059,7 @@ rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp, struct r_rpcb_rmtcallres r; rpcvers_t rpcb_vers; - + stat = 0; client = getclnthandle(host, nconf, NULL); if (client == NULL) { return (RPC_FAILED);