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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to