[PATCH] clk: meson: meson8b: fix a memory leak in meson8b_clkc_init_common()

Philipp Zabel p.zabel at pengutronix.de
Thu Apr 7 03:05:26 PDT 2022


On Do, 2022-04-07 at 17:28 +0800, xkernel.wang at foxmail.com wrote:
> From: Xiaoke Wang <xkernel.wang at foxmail.com>
> 
> `rstc` is allocated by kzalloc() for resetting the controller register,
> however, if reset_controller_register() fails, `rstc` is not properly
> released before returning, which can lead to memory leak.
> Therefore, this patch adds kfree(rstc) on the above error path.
> 
> Signed-off-by: Xiaoke Wang <xkernel.wang at foxmail.com>

Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>

regards
Philipp



More information about the linux-amlogic mailing list