dm: fix memory leak in dm_create_persistent() when starting metadata update thread...
authorJesper Juhl <[email protected]>
Wed, 18 Jul 2007 07:49:08 +0000 (00:49 -0700)
committerLinus Torvalds <[email protected]>
Wed, 18 Jul 2007 15:38:22 +0000 (08:38 -0700)
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 <[email protected]
Acked-by: Alasdair G Kergon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/md/dm-exception-store.c

index 3d65917a1bbbe97e2336d75255d97fe7a9ca2bf9..8fe81e1807e0cc9c7e35202990bc419274143335 100644 (file)
@@ -623,6 +623,7 @@ int dm_create_persistent(struct exception_store *store)
 
        ps->metadata_wq = create_singlethread_workqueue("ksnaphd");
        if (!ps->metadata_wq) {
+               kfree(ps);
                DMERR("couldn't start header metadata update thread");
                return -ENOMEM;
        }