Skip to contentSkip to conversation

text-based mount.nfs: Fix memory leak in add_mtab()

PATCH In review Chuck Lever 1 participant 1 message Sep 24, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/14 text-based mount.nfs: Fix memory leak in add_mtab()

The add_mtab() function in utils/mount/mount.c calls fix_opts_string() to construct an /etc/mtab entry, but never frees the result.

---

 utils/mount/mount.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
utils/mount/mount.c +2 -0
index 751fbb9..31e1969 100644
@@ -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;
 }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs