Skip to content

Commit

Permalink
libata-core: make sure that ata_force_tbl is freed in case of an error
Browse files Browse the repository at this point in the history
Fix a potential memory leak when ata_init() encounters an error.

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Elias Oltmanns authored and Jeff Garzik committed Jul 31, 2008
1 parent 2486fa5 commit 49ea3b0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 49ea3b0

Please sign in to comment.