From: Andrew Goodbody Date: Fri, 21 Nov 2025 17:34:33 +0000 (+0000) Subject: clk: Prevent memory leak on error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33285945518731ed459680ffb01891c4804fb6c9;p=thirdparty%2Fu-boot.git 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 --- 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