lkml.org 
[lkml]   [2015]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] edac: fix memory leaks on failure path in edac_init()
Date
edac_init() does not deallocate already allocated resources on failure path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
drivers/edac/edac_module.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index e6d1691dfa45..a256dcb31d03 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -112,7 +112,7 @@ static int __init edac_init(void)

err = edac_mc_sysfs_init();
if (err)
- goto error;
+ goto err_sysfs;

edac_debugfs_init();

@@ -120,12 +120,15 @@ static int __init edac_init(void)
err = edac_workqueue_setup();
if (err) {
edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n");
- goto error;
+ goto err_wq;
}

return 0;

-error:
+err_wq:
+ edac_debugfs_exit();
+ edac_mc_sysfs_exit();
+err_sysfs:
return err;
}

--
1.9.1


\
 
 \ /
  Last update: 2015-02-06 07:21    [W:0.259 / U:0.052 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site