Skip to content

Commit 145fc13

Browse files
frowandrobherring
authored andcommitted
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: 39a751a ("of: change overlay apply input data from unflattened to FDT") Reported-by: Erhard F. <[email protected]> Signed-off-by: Frank Rowand <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 216830d commit 145fc13

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/of/unittest.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3094,8 +3094,11 @@ static __init void of_unittest_overlay_high_level(void)
30943094
goto err_unlock;
30953095
}
30963096
if (__of_add_property(of_symbols, new_prop)) {
3097+
kfree(new_prop->name);
3098+
kfree(new_prop->value);
3099+
kfree(new_prop);
30973100
/* "name" auto-generated by unflatten */
3098-
if (!strcmp(new_prop->name, "name"))
3101+
if (!strcmp(prop->name, "name"))
30993102
continue;
31003103
unittest(0, "duplicate property '%s' in overlay_base node __symbols__",
31013104
prop->name);

0 commit comments

Comments
 (0)