clk: ti: composite: fix memory leak
authorTero Kristo <t-kristo@ti.com>
Wed, 29 Apr 2020 13:13:39 +0000 (16:13 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:50:26 +0000 (17:50 +0200)
[ Upstream commit c7c1cbbc9217ebb5601b88d138d4a5358548de9d ]

The parent_names is never released for a component clock definition,
causing some memory leak. Fix by releasing it once it is no longer
needed.

Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Link: https://lkml.kernel.org/r/20200429131341.4697-2-t-kristo@ti.com
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/ti/composite.c

index 6a89936..eaa4357 100644 (file)
@@ -196,6 +196,7 @@ cleanup:
                if (!cclk->comp_clks[i])
                        continue;
                list_del(&cclk->comp_clks[i]->link);
+               kfree(cclk->comp_clks[i]->parent_names);
                kfree(cclk->comp_clks[i]);
        }