Commit 618c810a authored by Gabor Juhos's avatar Gabor Juhos Committed by Georgi Djakov
Browse files

interconnect: icc-clk: destroy nodes in case of memory allocation failures



When memory allocation fails during creating the name of the nodes in
icc_clk_register(), the code continues on the error path and it calls
icc_nodes_remove() to destroy the already created nodes. However that
function only destroys the nodes which were already added to the provider
and the newly created nodes are never destroyed in case of error.

In order to avoid a memory leaks, change the code to destroy the newly
created nodes explicitly in case of memory allocation failures.

Fixes: 44c5aa73 ("interconnect: icc-clk: check return values of devm_kasprintf()")
Signed-off-by: default avatarGabor Juhos <j4g8y7@gmail.com>
Reviewed-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250625-icc-clk-memleak-fix-v1-1-4151484cd24f@gmail.com


Signed-off-by: default avatarGeorgi Djakov <djakov@kernel.org>
parent 1809db75
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment