提交 83c8c9bd 编写于 作者: J Jeff Liu 提交者: David Sterba

btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()

Signed-off-by: NJie Liu <jeff.liu@oracle.com>
上级 5ca49660
...@@ -419,7 +419,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, ...@@ -419,7 +419,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices) u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
{ {
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
char *opts, *orig, *p; char *device_name, *opts, *orig, *p;
int error = 0; int error = 0;
int intarg; int intarg;
...@@ -470,8 +470,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, ...@@ -470,8 +470,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
} }
break; break;
case Opt_device: case Opt_device:
error = btrfs_scan_one_device(match_strdup(&args[0]), device_name = match_strdup(&args[0]);
if (!device_name) {
error = -ENOMEM;
goto out;
}
error = btrfs_scan_one_device(device_name,
flags, holder, fs_devices); flags, holder, fs_devices);
kfree(device_name);
if (error) if (error)
goto out; goto out;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册