提交 e9982024 编写于 作者: C Colin Ian King 提交者: Alexandre Belloni

rtc: sun6i: ensure rtc is kfree'd on error

The error return path on clk_data allocation failure does not kfree
the allocated rtc object. Fix this with a kfree of rtc on the error
exit path.

Detected by CoverityScan, CID#1452264 ("Resource Leak")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
上级 6f2a71a3
...@@ -201,8 +201,10 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) ...@@ -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), clk_data = kzalloc(sizeof(*clk_data) + (sizeof(*clk_data->hws) * 2),
GFP_KERNEL); GFP_KERNEL);
if (!clk_data) if (!clk_data) {
kfree(rtc);
return; return;
}
spin_lock_init(&rtc->lock); spin_lock_init(&rtc->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册