summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2020-04-16 16:42:48 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-23 10:36:23 +0200
commit93ef21bb1a726bd2106bba584506011c8cee85b9 (patch)
treee4e08334ddb3bcb3a5e44b84cc7c3211b9e7d8bd
parenta1371954ee497836720138b2a90db873c35dff2c (diff)
of: unittest: kmemleak in of_unittest_overlay_high_level()
commit 145fc138f9aae4f9e1331352e301df28e16aed35 upstream. 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: 39a751a4cb7e ("of: change overlay apply input data from unflattened to FDT") Reported-by: Erhard F. <erhard_f@mailbox.org> Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/of/unittest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index b4cd0b3ff01d..5707c309a754 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -2481,8 +2481,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);