pinctrl: berlin: fix memory leak in berlin_pinctrl_build_state()
authorYuan Chen <chenyuan@kylinos.cn>
Fri, 20 Jun 2025 01:53:43 +0000 (09:53 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 24 Jun 2025 19:17:11 +0000 (21:17 +0200)
commit8f6f303551100291bf2c1e1ccc66b758fffb1168
tree970a8e15e1d51c9a46d7d6a5408ef352fd286c95
parente3507c56cbb208d4f160942748c527ef6a528ba1
pinctrl: berlin: fix memory leak in berlin_pinctrl_build_state()

In the original implementation, krealloc() failure handling incorrectly
assigned the original memory pointer to NULL after kfree(), causing a
memory leak when reallocation failed.

Fixes: de845036f997 ("pinctrl: berlin: fix error return code of berlin_pinctrl_build_state()")
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Link: https://lore.kernel.org/20250620015343.21494-1-chenyuan_fl@163.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/berlin/berlin.c