From: Chengguang Xu Date: Tue, 22 May 2018 04:24:25 +0000 (+0800) Subject: affs: fix potential memory leak when parsing option 'prefix' X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=84ae6f829fc2b23dd4985ab059cddfd4a1ccc14f;p=openwrt%2Fstaging%2Fblogic.git affs: fix potential memory leak when parsing option 'prefix' When specifying option 'prefix' multiple times, current option parsing will cause memory leak. Hence, call kfree for previous one in this case. Signed-off-by: Chengguang Xu Signed-off-by: David Sterba --- diff --git a/fs/affs/super.c b/fs/affs/super.c index e602619aed9d..d1ad11a8a4a5 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -241,6 +241,7 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved, affs_set_opt(*mount_opts, SF_NO_TRUNCATE); break; case Opt_prefix: + kfree(*prefix); *prefix = match_strdup(&args[0]); if (!*prefix) return 0;