From: Bart Van Assche Date: Tue, 18 Oct 2016 20:10:46 +0000 (-0700) Subject: nvme-fabrics: Fix memory leaks in nvmf_parse_options() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8eadfcb1b63d7d9cd21dc7a2fd1d92efc5730ddd;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git nvme-fabrics: Fix memory leaks in nvmf_parse_options() Signed-off-by: Bart Van Assche Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Signed-off-by: Sagi Grimberg --- diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 68fb26b3bfb9..12f19c4665cf 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -666,10 +666,12 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, if (nqnlen >= NVMF_NQN_SIZE) { pr_err("%s needs to be < %d bytes\n", p, NVMF_NQN_SIZE); + kfree(p); ret = -EINVAL; goto out; } opts->host = nvmf_host_add(p); + kfree(p); if (!opts->host) { ret = -ENOMEM; goto out;