aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-exception-store.c
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2007-07-18 03:49:08 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-18 11:38:22 -0400
commit851a8a7fd451db3dcd5d44d784083f0f66b24d57 (patch)
tree0d9e96cd7d3edecb05487366b8b1c8d363920516 /drivers/md/dm-exception-store.c
parentcb32da0416b823b7f4b65e7e85d6cba16ca4d1e1 (diff)
dm: fix memory leak in dm_create_persistent() when starting metadata update thread fails
If, in dm_create_persistent(), the call to create_singlethread_workqueue() fails then we'll return without freeing the memory allocated to 'ps', thus leaking sizeof(struct pstore) bytes. This patch fixes the leak. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com Acked-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/dm-exception-store.c')
-rw-r--r--drivers/md/dm-exception-store.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 3d65917a1bbb..8fe81e1807e0 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -623,6 +623,7 @@ int dm_create_persistent(struct exception_store *store)
623 623
624 ps->metadata_wq = create_singlethread_workqueue("ksnaphd"); 624 ps->metadata_wq = create_singlethread_workqueue("ksnaphd");
625 if (!ps->metadata_wq) { 625 if (!ps->metadata_wq) {
626 kfree(ps);
626 DMERR("couldn't start header metadata update thread"); 627 DMERR("couldn't start header metadata update thread");
627 return -ENOMEM; 628 return -ENOMEM;
628 } 629 }