summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2009-06-23 21:48:04 +0000
committerrmacklem <rmacklem@FreeBSD.org>2009-06-23 21:48:04 +0000
commit4a22bb75d23f761dc88e4dafb643bdbba8e34ba8 (patch)
tree9cc886b2a5aeee213a992ed75615037582aaa47f /usr.sbin
parent4528681d83169ec32bc34a21b4f701f050b704f7 (diff)
downloadFreeBSD-src-4a22bb75d23f761dc88e4dafb643bdbba8e34ba8.zip
FreeBSD-src-4a22bb75d23f761dc88e4dafb643bdbba8e34ba8.tar.gz
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)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mountd/mountd.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index b6ca3cd..6fcb884 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -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.
OpenPOWER on IntegriCloud