mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 05:27:07 +02:00
ARM: mxs: fix memory leak in mxs_machine_init()
[ Upstream commitf31e3c204d] If of_property_read_string() failed, 'soc_dev_attr' should be freed before return. Otherwise there is a memory leak. Fixes:2046338dcb("ARM: mxs: Use soc bus infrastructure") Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5c97af75f5
commit
290a71ff72
|
|
@ -387,8 +387,10 @@ static void __init mxs_machine_init(void)
|
||||||
|
|
||||||
root = of_find_node_by_path("/");
|
root = of_find_node_by_path("/");
|
||||||
ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
|
ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
kfree(soc_dev_attr);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
soc_dev_attr->family = "Freescale MXS Family";
|
soc_dev_attr->family = "Freescale MXS Family";
|
||||||
soc_dev_attr->soc_id = mxs_get_soc_id();
|
soc_dev_attr->soc_id = mxs_get_soc_id();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user