[PATCH v2 3/4] clk: imx: cpu: avoid use after free on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Oleksij Rempel <linux@xxxxxxxxxxxxxxxx>
---
 drivers/clk/imx/clk-cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-cpu.c b/drivers/clk/imx/clk-cpu.c
index 5ac0ed178..473500131 100644
--- a/drivers/clk/imx/clk-cpu.c
+++ b/drivers/clk/imx/clk-cpu.c
@@ -111,8 +111,10 @@ struct clk *imx_clk_cpu(const char *name, const char *parent_name,
 	cpu->clk.num_parents = 1;
 
 	ret = clk_register(&cpu->clk);
-	if (ret)
+	if (ret) {
 		free(cpu);
+		return NULL;
+	}
 
 	return &cpu->clk;
 }
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux