Skip to content

Commit

Permalink
soc: aspeed: socinfo: Add kfree for kstrdup
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joel Stanley <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
JiangJias authored and arndb committed Aug 12, 2023
1 parent e4ad279 commit 6e6d847
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/soc/aspeed/aspeed-socinfo.c
Original file line number Diff line number Diff line change
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 6e6d847

Please sign in to comment.