Kaynağa Gözat

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 <cgxu519@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Chengguang Xu 7 yıl önce
ebeveyn
işleme
84ae6f829f
1 değiştirilmiş dosya ile 1 ekleme ve 0 silme
  1. 1 0
      fs/affs/super.c

+ 1 - 0
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;