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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to