svn commit: r225674 - stable/8/sbin/mount

John Baldwin jhb at FreeBSD.org
Mon Sep 19 16:28:37 UTC 2011


Author: jhb
Date: Mon Sep 19 16:28:36 2011
New Revision: 225674
URL: http://svn.freebsd.org/changeset/base/225674

Log:
  MFC 225341:
  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.

Modified:
  stable/8/sbin/mount/mount.c
Directory Properties:
  stable/8/sbin/mount/   (props changed)

Modified: stable/8/sbin/mount/mount.c
==============================================================================
--- stable/8/sbin/mount/mount.c	Mon Sep 19 16:25:37 2011	(r225673)
+++ stable/8/sbin/mount/mount.c	Mon Sep 19 16:28:36 2011	(r225674)
@@ -588,6 +588,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);
 	}
 
@@ -598,6 +601,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-stable-8 mailing list