diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 4c7818276857..f238b7a3865d 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);