Commit a90e8b6f authored by Ilya Dryomov's avatar Ilya Dryomov

Btrfs: fix memory leak in btrfs_parse_early_options()

Don't leak subvol_name string in case multiple subvol= options are
given.  "The lastest option is effective" behavior (consistent with
subvolid= and subvolrootid= options) is preserved.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 7fd2ae21
...@@ -448,6 +448,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, ...@@ -448,6 +448,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
token = match_token(p, tokens, args); token = match_token(p, tokens, args);
switch (token) { switch (token) {
case Opt_subvol: case Opt_subvol:
kfree(*subvol_name);
*subvol_name = match_strdup(&args[0]); *subvol_name = match_strdup(&args[0]);
break; break;
case Opt_subvolid: case Opt_subvolid:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment