* [patch 2/2] libata-core: make sure that ata_force_tbl is freed in case of an error
@ 2008-07-30 19:32 akpm
2008-07-31 5:50 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2008-07-30 19:32 UTC (permalink / raw)
To: jeff; +Cc: linux-ide, akpm, eo, alan, tj
From: Elias Oltmanns <eo@nebensachen.de>
Fix a potential memory leak when ata_init() encounters an error.
Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/ata/libata-core.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff -puN drivers/ata/libata-core.c~libata-core-make-sure-that-ata_force_tbl-is-freed-in-case-of-an-error drivers/ata/libata-core.c
--- a/drivers/ata/libata-core.c~libata-core-make-sure-that-ata_force_tbl-is-freed-in-case-of-an-error
+++ a/drivers/ata/libata-core.c
@@ -6088,16 +6088,20 @@ static int __init ata_init(void)
ata_wq = create_workqueue("ata");
if (!ata_wq)
- return -ENOMEM;
+ goto free_force_tbl;
ata_aux_wq = create_singlethread_workqueue("ata_aux");
- if (!ata_aux_wq) {
- destroy_workqueue(ata_wq);
- return -ENOMEM;
- }
+ if (!ata_aux_wq)
+ goto free_wq;
printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
return 0;
+
+free_wq:
+ destroy_workqueue(ata_wq);
+free_force_tbl:
+ kfree(ata_force_tbl);
+ return -ENOMEM;
}
static void __exit ata_exit(void)
_
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-31 5:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-30 19:32 [patch 2/2] libata-core: make sure that ata_force_tbl is freed in case of an error akpm
2008-07-31 5:50 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).