提交 145fc138 编写于 作者: F Frank Rowand 提交者: Rob Herring

of: unittest: kmemleak in of_unittest_overlay_high_level()

kmemleak reports several memory leaks from devicetree unittest.
This is the fix for problem 3 of 5.

of_unittest_overlay_high_level() failed to kfree the newly created
property when the property named 'name' is skipped.

Fixes: 39a751a4 ("of: change overlay apply input data from unflattened to FDT")
Reported-by: NErhard F. <erhard_f@mailbox.org>
Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
Signed-off-by: NRob Herring <robh@kernel.org>
上级 216830d2
......@@ -3094,8 +3094,11 @@ static __init void of_unittest_overlay_high_level(void)
goto err_unlock;
}
if (__of_add_property(of_symbols, new_prop)) {
kfree(new_prop->name);
kfree(new_prop->value);
kfree(new_prop);
/* "name" auto-generated by unflatten */
if (!strcmp(new_prop->name, "name"))
if (!strcmp(prop->name, "name"))
continue;
unittest(0, "duplicate property '%s' in overlay_base node __symbols__",
prop->name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册