* [PATCH] Fix memory leak in dm_create_persistent() when starting metadata update thread fails.
@ 2007-07-16 19:41 Jesper Juhl
0 siblings, 0 replies; only message in thread
From: Jesper Juhl @ 2007-07-16 19:41 UTC (permalink / raw)
To: dm-devel
Cc: Linux Kernel Mailing List, Andrew Morton, Alasdair G Kergon, 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 <jesper.juhl@gmail.com
---
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 3d65917..8fe81e1 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)
ps->metadata_wq = create_singlethread_workqueue("ksnaphd");
if (!ps->metadata_wq) {
+ kfree(ps);
DMERR("couldn't start header metadata update thread");
return -ENOMEM;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-16 19:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 19:41 [PATCH] Fix memory leak in dm_create_persistent() when starting metadata update thread fails Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome