Skip to content

Commit

Permalink
soc: aspeed: socinfo: Add kfree for kstrdup
Browse files Browse the repository at this point in the history
[ Upstream commit 6e6d847 ]

Add kfree() in the later error handling in order to avoid memory leak.

Fixes: e0218dc ("soc: aspeed: Add soc info driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20230707021625.7727-1-jiasheng@iscas.ac.cn
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20230810123104.231167-1-joel@jms.id.au
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
JiangJias authored and gregkh committed Aug 23, 2023
1 parent 15db1e5 commit b662856
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/soc/aspeed/aspeed-socinfo.c
Expand Up @@ -137,6 +137,7 @@ static int __init aspeed_socinfo_init(void)

soc_dev = soc_device_register(attrs);
if (IS_ERR(soc_dev)) {
kfree(attrs->machine);
kfree(attrs->soc_id);
kfree(attrs->serial_number);
kfree(attrs);
Expand Down

0 comments on commit b662856

Please sign in to comment.