]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
text-based mount.nfs: Fix memory leak in add_mtab()
authorChuck Lever <chuck.lever@oracle.com>
Mon, 24 Sep 2007 15:28:44 +0000 (11:28 -0400)
committerNeil Brown <neilb@suse.de>
Tue, 25 Sep 2007 01:50:15 +0000 (11:50 +1000)
The add_mtab() function in utils/mount/mount.c calls fix_opts_string() to
construct an /etc/mtab entry, but never frees the result.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/mount/mount.c

index 751fbb9c74b0c1a5c5b6007da4ef1f6d78dddaea..31e196952a0d53ab689d8b94a2a70b3216727adf 100644 (file)
@@ -237,6 +237,7 @@ static int add_mtab(char *spec, char *mount_point, char *fstype,
 
        if (flags & MS_REMOUNT) {
                update_mtab(ment.mnt_dir, &ment);
+               free(ment.mnt_opts);
                return EX_SUCCESS;
        }
 
@@ -267,6 +268,7 @@ fail_close:
        endmntent(mtab);
 fail_unlock:
        unlock_mtab();
+       free(ment.mnt_opts);
 
        return result;
 }