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: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
This commit is contained in:
parent
6f2a71a31a
commit
e998202461
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue