[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230707021625.7727-1-jiasheng@iscas.ac.cn>
Date: Fri, 7 Jul 2023 10:16:25 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: joel@....id.au, andrew@...id.au
Cc: linux-arm-kernel@...ts.infradead.org,
linux-aspeed@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] soc: aspeed: socinfo: Add kfree for kstrdup
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@...as.ac.cn>
---
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.25.1
Powered by blists - more mailing lists