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

From: Philipp Zabel
Date: Thu Apr 07 2022 - 06:05:55 EST


On Do, 2022-04-07 at 17:28 +0800, xkernel.wang@xxxxxxxxxxx wrote:
> From: Xiaoke Wang <xkernel.wang@xxxxxxxxxxx>
>
> `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@xxxxxxxxxxx>

Reviewed-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>

regards
Philipp