[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1470232916-82917-1-git-send-email-jthumshirn@suse.de>
Date: Wed, 3 Aug 2016 16:01:56 +0200
From: Johannes Thumshirn <jthumshirn@...e.de>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Linux NVDIMM Mailing List <linux-nvdimm@...ts.01.org>,
Linux Kernel Mailinglist <linux-kernel@...r.kernel.org>,
Johannes Thumshirn <jthumshirn@...e.de>
Subject: [PATCH] libnvdimm: Fix memory leak in error path.
If either device_register() or nvdimm_bus_create_ndclt() fails we leak the
memory allocated for nvdimm_bus. Call kfree(nvdimm_bus) in the error path so
it's not leaked.
Signed-off-by: Johannes Thumshirn <jthumshirn@...e.de>
---
drivers/nvdimm/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
index be89764..8578365 100644
--- a/drivers/nvdimm/core.c
+++ b/drivers/nvdimm/core.c
@@ -366,6 +366,7 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
return nvdimm_bus;
err:
put_device(&nvdimm_bus->dev);
+ kfree(nvdimm_bus);
return NULL;
}
EXPORT_SYMBOL_GPL(__nvdimm_bus_register);
--
1.8.5.6
Powered by blists - more mailing lists