svn commit: r301144 - stable/10/usr.sbin/ypserv

Don Lewis truckman at FreeBSD.org
Wed Jun 1 17:20:38 UTC 2016


Author: truckman
Date: Wed Jun  1 17:20:36 2016
New Revision: 301144
URL: https://svnweb.freebsd.org/changeset/base/301144

Log:
  MFC r300636
  
  Delay calling yp_malloc_dnsent() until after some additional sanity
  checks to avoid leaking memory on error returns.
  
  Reported by:	Coverity
  CID:		1007416

Modified:
  stable/10/usr.sbin/ypserv/yp_dnslookup.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ypserv/yp_dnslookup.c
==============================================================================
--- stable/10/usr.sbin/ypserv/yp_dnslookup.c	Wed Jun  1 17:18:35 2016	(r301143)
+++ stable/10/usr.sbin/ypserv/yp_dnslookup.c	Wed Jun  1 17:20:36 2016	(r301144)
@@ -489,9 +489,6 @@ yp_async_lookup_addr(struct svc_req *rqs
 	    yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL)
 		return(YP_TRUE);
 
-	if ((q = yp_malloc_dnsent()) == NULL)
-		return(YP_YPERR);
-
 	switch (af) {
 	case AF_INET:
 		if (inet_aton(addr, (struct in_addr *)uaddr) != 1)
@@ -516,6 +513,9 @@ yp_async_lookup_addr(struct svc_req *rqs
 		return(YP_YPERR);
 	}
 
+	if ((q = yp_malloc_dnsent()) == NULL)
+		return(YP_YPERR);
+
 	if (debug)
 		yp_error("DNS address is: %s", buf);
 


More information about the svn-src-all mailing list