Commit 99dc4ad9 authored by Colin Ian King's avatar Colin Ian King Committed by Miquel Raynal
Browse files

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: 88d12502 ("mtd: devices: add support for microchip 48l640 EERAM")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarHeiko Schocher <hs@denx.de>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210712145214.101377-1-colin.king@canonical.com
parent 2394e628
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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: