Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Colin Ian King and committed by
Miquel Raynal
99dc4ad9 2394e628

+1
+1
drivers/mtd/devices/mchp48l640.c
··· 255 255 if (!ret) 256 256 *retlen += len; 257 257 258 + kfree(cmd); 258 259 return ret; 259 260 260 261 fail: