提交 c76eb11c 编写于 作者: S Sudip Mukherjee 提交者: Michael Turquette

clk: gpio: fix memory leak

If we fail to allocate parent_name then we are returning but we missed
freeing data which has already been allocated.
Signed-off-by: NSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: NMichael Turquette <mturquette@baylibre.com>
上级 9e256c72
...@@ -294,8 +294,10 @@ static void __init of_gpio_clk_setup(struct device_node *node, ...@@ -294,8 +294,10 @@ static void __init of_gpio_clk_setup(struct device_node *node,
num_parents = of_clk_get_parent_count(node); num_parents = of_clk_get_parent_count(node);
parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL); parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
if (!parent_names) if (!parent_names) {
kfree(data);
return; return;
}
for (i = 0; i < num_parents; i++) for (i = 0; i < num_parents; i++)
parent_names[i] = of_clk_get_parent_name(node, i); parent_names[i] = of_clk_get_parent_name(node, i);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册