summaryrefslogtreecommitdiff
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-07-12 15:52:14 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2021-08-06 21:44:09 +0200
commit99dc4ad992bf156692b088fab4d98deab7cbd3e6 (patch)
treebd6c484643c14dd318916406b8cd18b2cfe3dc32 /drivers/mtd/devices
parent2394e628738933aa014093d93093030f6232946d (diff)
mtd: devices: mchp48l640: Fix memory leak on cmd
The allocation for cmd is not being kfree'd on the return leading to a memory leak. Fix this by kfree'ing it. Addresses-Coverity: ("Resource leak") Fixes: 88d125026753 ("mtd: devices: add support for microchip 48l640 EERAM") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210712145214.101377-1-colin.king@canonical.com
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/mchp48l640.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c
index ad66b5aaf4e9..99400d0fb8c1 100644
--- a/drivers/mtd/devices/mchp48l640.c
+++ b/drivers/mtd/devices/mchp48l640.c
@@ -255,6 +255,7 @@ static int mchp48l640_read_page(struct mtd_info *mtd, loff_t from, size_t len,
if (!ret)
*retlen += len;
+ kfree(cmd);
return ret;
fail: