Date: Wed, 1 Jun 2016 17:20:36 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r301144 - stable/10/usr.sbin/ypserv Message-ID: <201606011720.u51HKamb048650@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606011720.u51HKamb048650>