svn commit: r225341 - head/sbin/mount

John Baldwin jhb at FreeBSD.org
Fri Sep 2 17:12:00 UTC 2011


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) {


More information about the svn-src-all mailing list