Subject: dm: fix memory leak in dm_create_persistent() when starting metadata update thread fails From: Jesper Juhl 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 Signed-off-by: Andrew Morton --- drivers/md/dm-exception-store.c | 1 + 1 files changed, 1 insertion(+) Index: linux-2.6.22/drivers/md/dm-exception-store.c =================================================================== --- linux-2.6.22.orig/drivers/md/dm-exception-store.c 2007-07-17 16:26:09.000000000 +0100 +++ linux-2.6.22/drivers/md/dm-exception-store.c 2007-07-17 16:30:01.000000000 +0100 @@ -623,6 +623,7 @@ int dm_create_persistent(struct exceptio ps->metadata_wq = create_singlethread_workqueue("ksnaphd"); if (!ps->metadata_wq) { + kfree(ps); DMERR("couldn't start header metadata update thread"); return -ENOMEM; }