From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:48:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26643106564A; Tue, 23 Jun 2009 21:48:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 149E58FC18; Tue, 23 Jun 2009 21:48:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLm4pW091250; Tue, 23 Jun 2009 21:48:04 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLm4fX091248; Tue, 23 Jun 2009 21:48:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200906232148.n5NLm4fX091248@svn.freebsd.org> From: Rick Macklem Date: Tue, 23 Jun 2009 21:48:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194773 - head/usr.sbin/mountd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:48:05 -0000 Author: rmacklem Date: Tue Jun 23 21:48:04 2009 New Revision: 194773 URL: http://svn.freebsd.org/changeset/base/194773 Log: When mountd.c parses the nfsv4 root line(s) in /etc/exports, it allocates data structures that are never linked into the tree or free'd. As such, mountd would leak memory every time it parsed an nfsv4 root line. This patch frees up those structures to plug the leak. Approved by: kib (mentor) Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Jun 23 21:45:33 2009 (r194772) +++ head/usr.sbin/mountd/mountd.c Tue Jun 23 21:48:04 2009 (r194773) @@ -1414,8 +1414,20 @@ get_exportlist_one() /* * For V4: don't enter in mount lists. */ - if (v4root_phase > 0 && v4root_phase <= 2) + if (v4root_phase > 0 && v4root_phase <= 2) { + /* + * Since these structures aren't used by mountd, + * free them up now. + */ + if (ep != NULL) + free_exp(ep); + while (tgrp != NULL) { + grp = tgrp; + tgrp = tgrp->gr_next; + free_grp(grp); + } goto nextline; + } /* * Success. Update the data structures.