Skip to content

Commit

Permalink
affs: fix potential memory leak when parsing option 'prefix'
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
Chengguang Xu authored and kdave committed May 28, 2018
1 parent b506943 commit 84ae6f8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 84ae6f8

Please sign in to comment.