Commit 8eadfcb1 authored by Bart Van Assche's avatar Bart Van Assche Committed by Sagi Grimberg

nvme-fabrics: Fix memory leaks in nvmf_parse_options()

Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent 76c08bf4
...@@ -666,10 +666,12 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, ...@@ -666,10 +666,12 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
if (nqnlen >= NVMF_NQN_SIZE) { if (nqnlen >= NVMF_NQN_SIZE) {
pr_err("%s needs to be < %d bytes\n", pr_err("%s needs to be < %d bytes\n",
p, NVMF_NQN_SIZE); p, NVMF_NQN_SIZE);
kfree(p);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
opts->host = nvmf_host_add(p); opts->host = nvmf_host_add(p);
kfree(p);
if (!opts->host) { if (!opts->host) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
......
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