Btrfs: async-thread: fix possible memory leak
authorLi Zefan <lizf@cn.fujitsu.com>
Wed, 30 Jul 2008 13:24:37 +0000 (09:24 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:05 +0000 (11:04 -0400)
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>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/async-thread.c

index 8d4cc4679d51ca8471f0086416aecc0474e3cd65..5fe6a0d532ed46a353b663ce4a13692313522399 100644 (file)
@@ -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;
                }