Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1733445 > unrolled thread
| Started by | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| First post | 2017-09-17 14:50 +0200 |
| Last post | 2017-09-17 14:50 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH] rtc: sun6i: fix memory leak Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2017-09-17 14:50 +0200
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2017-09-17 14:50 +0200 |
| Subject | [PATCH] rtc: sun6i: fix memory leak |
| Message-ID | <uqHbj-818-5@gated-at.bofh.it> |
If 'clk_data' is not allocated we returned but we failed to free 'rtc'.
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
drivers/rtc/rtc-sun6i.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index 3d2216c..5bc28ee 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -201,8 +201,10 @@ static void __init sun6i_rtc_clk_init(struct device_node *node)
clk_data = kzalloc(sizeof(*clk_data) + (sizeof(*clk_data->hws) * 2),
GFP_KERNEL);
- if (!clk_data)
+ if (!clk_data) {
+ kfree(rtc);
return;
+ }
spin_lock_init(&rtc->lock);
--
2.7.4
Back to top | Article view | linux.kernel
csiph-web