Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c76eb11c authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Michael Turquette
Browse files

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: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarMichael Turquette <mturquette@baylibre.com>
parent 9e256c72
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -294,8 +294,10 @@ static void __init of_gpio_clk_setup(struct device_node *node,
	num_parents = of_clk_get_parent_count(node);

	parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
	if (!parent_names)
	if (!parent_names) {
		kfree(data);
		return;
	}

	for (i = 0; i < num_parents; i++)
		parent_names[i] = of_clk_get_parent_name(node, i);