From: Frank Rowand Date: Thu, 16 Apr 2020 21:42:48 +0000 (-0500) Subject: of: unittest: kmemleak in of_unittest_overlay_high_level() X-Git-Tag: v5.15~3977^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=145fc138f9aae4f9e1331352e301df28e16aed35;p=platform%2Fkernel%2Flinux-starfive.git 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: 39a751a4cb7e ("of: change overlay apply input data from unflattened to FDT") Reported-by: Erhard F. Signed-off-by: Frank Rowand Signed-off-by: Rob Herring --- diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 4c78182..f238b7a 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -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);