Don't leak allocated memory for mci_pdev
Signed-off-by: Denis Kirjanov <[email protected]>
---
drivers/edac/edac_mc_sysfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index ea34ece..689d7ba 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -1141,12 +1141,14 @@ int __init edac_mc_sysfs_init(void)
err = device_add(mci_pdev);
if (err < 0)
- return err;
+ goto out_dev_free;
edac_dbg(0, "device %s created\n", dev_name(mci_pdev));
return 0;
+out_dev_free:
+ kfree(mci_pdev);
out_put_sysfs:
edac_put_sysfs_subsys();
out:
@@ -1158,4 +1160,5 @@ void __exit edac_mc_sysfs_exit(void)
put_device(mci_pdev);
device_del(mci_pdev);
edac_put_sysfs_subsys();
+ kfree(mci_pdev);
}
--
1.7.9.5