public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] async-thread: fix possible memory leak
@ 2008-07-25  5:34 Li Zefan
  2008-07-25 12:45 ` Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zefan @ 2008-07-25  5:34 UTC (permalink / raw)
  To: linux-btrfs

When kthread_run() returns failure, this worker hasn't been
added to the list, so btrfs_stop_workers() won't free it.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 async-thread.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/async-thread.c b/async-thread.c
index 8d4cc46..5fe6a0d 100644
--- a/async-thread.c
+++ b/async-thread.c
@@ -187,6 +187,7 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers)
 		worker->task = kthread_run(worker_loop, worker, "btrfs");
 		worker->workers = workers;
 		if (IS_ERR(worker->task)) {
+			kfree(worker);
 			ret = PTR_ERR(worker->task);
 			goto fail;
 		}
-- 
1.5.4.rc3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-25 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-25  5:34 [PATCH] async-thread: fix possible memory leak Li Zefan
2008-07-25 12:45 ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox