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

irqchip/wpcm450: Fix memory leak in wpcm450_aic_of_init()

If of_iomap() failed, 'aic' should be freed before return. Otherwise
there is a memory leak.

Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221115092532.1704032-1-weiyongjun@huaweicloud.com

authored by

Wei Yongjun and committed by
Marc Zyngier
4208d4fa 4e08a286

+1
+1
drivers/irqchip/irq-wpcm450-aic.c
··· 146 146 aic->regs = of_iomap(node, 0); 147 147 if (!aic->regs) { 148 148 pr_err("Failed to map WPCM450 AIC registers\n"); 149 + kfree(aic); 149 150 return -ENOMEM; 150 151 } 151 152