Linux SOC development
 help / color / mirror / Atom feed
* [PATCH] soc: aspeed: socinfo: Add kfree for kstrdup
@ 2023-08-10 12:31 Joel Stanley
  2023-08-12 10:20 ` patchwork-bot+linux-soc
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Stanley @ 2023-08-10 12:31 UTC (permalink / raw)
  To: soc

From: Jiasheng Jiang <jiasheng@iscas.ac.cn>

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

Fixes: e0218dca5787 ("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>
---
Hi soc maintainers, this is a low priority fix to be merged when appropriate.

 drivers/soc/aspeed/aspeed-socinfo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/aspeed/aspeed-socinfo.c b/drivers/soc/aspeed/aspeed-socinfo.c
index 1ca140356a08..3f759121dc00 100644
--- a/drivers/soc/aspeed/aspeed-socinfo.c
+++ b/drivers/soc/aspeed/aspeed-socinfo.c
@@ -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);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-12 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 12:31 [PATCH] soc: aspeed: socinfo: Add kfree for kstrdup Joel Stanley
2023-08-12 10:20 ` patchwork-bot+linux-soc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox