From: Elias Oltmanns Date: Wed, 30 Jul 2008 19:32:39 +0000 (-0700) Subject: libata-core: make sure that ata_force_tbl is freed in case of an error X-Git-Tag: v2.6.27-rc2~90^2~3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49ea3b04971ece6a5efe5d7b763ad9d2f169d441;p=linux-2.6 libata-core: make sure that ata_force_tbl is freed in case of an error Fix a potential memory leak when ata_init() encounters an error. Signed-off-by: Elias Oltmanns Cc: Tejun Heo Cc: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 9cd04f6841..f69d1548b5 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6098,16 +6098,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)