From 33285945518731ed459680ffb01891c4804fb6c9 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Fri, 21 Nov 2025 17:34:33 +0000 Subject: [PATCH] clk: Prevent memory leak on error In clk_set_default_rates() memory is allocated to store the clock rates that are read. Direct returns fail to free this memory leading to a memory leak so instead use 'goto fail;' which will then perform the free before exiting the function. Signed-off-by: Andrew Goodbody --- drivers/clk/clk-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index a72a67d75a1..bf9f1041935 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -338,7 +338,7 @@ static int clk_set_default_rates(struct udevice *dev, continue; } - return ret; + goto fail; } /* This is clk provider device trying to program itself -- 2.47.3