Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 May 2016 02:53:11 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300388 - head/lib/libc/rpc
Message-ID:  <201605220253.u4M2rBIS095910@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun May 22 02:53:11 2016
New Revision: 300388
URL: https://svnweb.freebsd.org/changeset/base/300388

Log:
  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

Modified:
  head/lib/libc/rpc/rpcb_clnt.c

Modified: head/lib/libc/rpc/rpcb_clnt.c
==============================================================================
--- head/lib/libc/rpc/rpcb_clnt.c	Sun May 22 02:24:38 2016	(r300387)
+++ head/lib/libc/rpc/rpcb_clnt.c	Sun May 22 02:53:11 2016	(r300388)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605220253.u4M2rBIS095910>