From d97d88b288413b4e528e22739bfb08594efe9940 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Mon, 24 Sep 2007 11:28:44 -0400 Subject: [PATCH] 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. Signed-off-by: Chuck Lever Signed-off-by: Neil Brown --- utils/mount/mount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/mount/mount.c b/utils/mount/mount.c index 751fbb9..31e1969 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -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; } -- 2.39.5