[PATH v2] pinctrl: sunxi: Fix memory leak on krealloc failure in sunxi_pctrl_dt_node_to_map
Linus Walleij
linus.walleij at linaro.org
Tue Jun 24 12:15:58 PDT 2025
On Fri, Jun 20, 2025 at 3:27 AM Yuan Chen <chenyuan_fl at 163.com> wrote:
> From: Yuan Chen <chenyuan at kylinos.cn>
>
> In sunxi_pctrl_dt_node_to_map(), when krealloc() fails to resize the pinctrl_map
> array, the function returns -ENOMEM directly without freeing the previously
> allocated *map buffer. This results in a memory leak of the original kmalloc_array
> allocation.
>
> Fixes: e11dee2e98f8 ("pinctrl: sunxi: Deal with configless pins")
> Signed-off-by: Yuan Chen <chenyuan at kylinos.cn>
Patch applied for fixes!
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list