Btrfs: async-thread: fix possible memory leak

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>
This commit is contained in:
Li Zefan 2008-07-30 09:24:37 -04:00 committed by Chris Mason
parent ab78c84de1
commit 3bf1041867

View 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;
}