diff mbox series

[2/2] spi: spi-mem: Fix a memory leak in spi_mem_dirmap_destroy()

Message ID 20190119145757.1735-2-bbrezillon@kernel.org (mailing list archive)
State Accepted
Commit bfecfd6e23bf677c85828eb20fa4b13a18bffe23
Headers show
Series None | expand

Commit Message

Boris Brezillon Jan. 19, 2019, 2:57 p.m. UTC
The dirmap descriptor object allocated in spi_mem_dirmap_create is
never freed. Add a kfree(desc) in spi_mem_dirmap_destroy().

Fixes: aa167f3fed0c ("spi: spi-mem: Add a new API to support direct mapping")
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
---
 drivers/spi/spi-mem.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 08ba43506e81..9487c9cd68bd 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -547,6 +547,8 @@  void spi_mem_dirmap_destroy(struct spi_mem_dirmap_desc *desc)
 
 	if (!desc->nodirmap && ctlr->mem_ops && ctlr->mem_ops->dirmap_destroy)
 		ctlr->mem_ops->dirmap_destroy(desc);
+
+	kfree(desc);
 }
 EXPORT_SYMBOL_GPL(spi_mem_dirmap_destroy);