Skip to content

Commit

Permalink
mtd: devices: mchp48l640: Fix memory leak on cmd
Browse files Browse the repository at this point in the history
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: 88d1250 ("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
  • Loading branch information
Colin Ian King authored and miquelraynal committed Aug 6, 2021
1 parent 2394e62 commit 99dc4ad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/mtd/devices/mchp48l640.c
Expand Up @@ -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:
Expand Down

0 comments on commit 99dc4ad

Please sign in to comment.