[PATCH v2] ti: fix possible memory leak in _ti_omap4_clkctrl_setup()

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

 



kstrndup() and kstrdup_and_replace() in clkctrl_get_name() can perform
dynamic memory allocation. So clkctrl_name() needs to be freed when
provider->clkdm_name is NULL.

Fixes: bd46cd0b802d ("clk: ti: clkctrl: check return value of kasprintf()")
Signed-off-by: Hangyu Hua <hbh25y@xxxxxxxxx>
---

	v2: fix commit info.

 drivers/clk/ti/clkctrl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 607e34d8e289..cb4aa8a45bb2 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -591,6 +591,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
 		provider->clkdm_name = kasprintf(GFP_KERNEL,
 						 "%s_clkdm", clkctrl_name);
 		if (!provider->clkdm_name) {
+			kfree(clkctrl_name);
 			kfree(provider);
 			return;
 		}
-- 
2.34.1




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux