Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Sep 2011 17:11:59 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r225341 - head/sbin/mount
Message-ID:  <201109021711.p82HBxSS008501@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Sep  2 17:11:59 2011
New Revision: 225341
URL: http://svn.freebsd.org/changeset/base/225341

Log:
  Clear the mountprog variable after each mountfs() call so that mountprog
  options don't leak over into subsequent mounts listed in /etc/fstab.
  While here, fix a memory leak in debug mode.
  
  Reported by:	rank1seeker @ gmail
  Approved by:	re (kib)
  MFC after:	1 week

Modified:
  head/sbin/mount/mount.c

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Fri Sep  2 17:06:50 2011	(r225340)
+++ head/sbin/mount/mount.c	Fri Sep  2 17:11:59 2011	(r225341)
@@ -589,6 +589,9 @@ mountfs(const char *vfstype, const char 
 		for (i = 1; i < mnt_argv.c; i++)
 			(void)printf(" %s", mnt_argv.a[i]);
 		(void)printf("\n");
+		free(optbuf);
+		free(mountprog);
+		mountprog = NULL;
 		return (0);
 	}
 
@@ -599,6 +602,8 @@ mountfs(const char *vfstype, const char 
 	}
 
 	free(optbuf);
+	free(mountprog);
+	mountprog = NULL;
 
 	if (verbose) {
 		if (statfs(name, &sf) < 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109021711.p82HBxSS008501>