lkml.org 
[lkml]   [2021]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] powerpc/sysdev/of_rtc: Fix possible memory leak in of_instantiate_rtc
Date
If of_address_to_resource() in of_instantiate_rtc() fails, previously
allocated memory res is not freed. Add missing kfree() for it.

Signed-off-by: He Ying <heying24@huawei.com>
---
arch/powerpc/sysdev/of_rtc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/of_rtc.c b/arch/powerpc/sysdev/of_rtc.c
index 1f408d34a6a7..23b896996c2f 100644
--- a/arch/powerpc/sysdev/of_rtc.c
+++ b/arch/powerpc/sysdev/of_rtc.c
@@ -44,6 +44,7 @@ void __init of_instantiate_rtc(void)
printk(KERN_ERR "OF RTC: Error "
"translating resources for %pOF\n",
node);
+ kfree(res);
continue;
}

--
2.17.1
\
 
 \ /
  Last update: 2021-11-03 02:46    [W:0.261 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site