Message ID | 20210712145214.101377-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | mtd: devices: mchp48l640: Fix memory leak on cmd | expand |
On Mon, 2021-07-12 at 14:52:14 UTC, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > 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> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks. Miquel
Hello Colin, On 12.07.21 16:52, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > 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> > --- > drivers/mtd/devices/mchp48l640.c | 1 + > 1 file changed, 1 insertion(+) Good catch, thanks! Reviewed-by: Heiko Schocher <hs@denx.de> bye, Heiko
diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c index efc2003bd13a..c0b1a7bb7d13 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: