From 51bc13d3c81ab5976e90f06b8ac1c472bec59c8b Mon Sep 17 00:00:00 2001 From: shichangkuo Date: Wed, 7 Feb 2018 17:25:08 +0800 Subject: [PATCH] mount.ocfs2: Fix double free problems when remounting a device We should free the old mnt_opts, and duplicate a new one from instead->mnt_opts. Signed-off-by: shichangkuo --- mount.ocfs2/fstab.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mount.ocfs2/fstab.c b/mount.ocfs2/fstab.c index d3fc617..59cd369 100644 --- a/mount.ocfs2/fstab.c +++ b/mount.ocfs2/fstab.c @@ -612,7 +612,8 @@ update_mtab (const char *dir, struct my_mntent *instead) { } } else { /* A remount */ - mc->m.mnt_opts = instead->mnt_opts; + my_free(mc->m.mnt_opts); + mc->m.mnt_opts = xstrdup(instead->mnt_opts); } } else if (instead) { /* not found, add a new entry */ -- 1.7.9.5