SUNRPC: Ensure rpc_call_async() always calls tk_ops->rpc_release()
[linux-2.6-block.git] / net / sunrpc / sched.c
index cd51b54683323cad7988c2b835714c2bb738c567..3fc13bea302d49648ebd7f58329f48dcc03747e6 100644 (file)
@@ -921,8 +921,11 @@ struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
 {
        struct rpc_task *task;
        task = rpc_new_task(clnt, flags, ops, data);
-       if (task == NULL)
+       if (task == NULL) {
+               if (ops->rpc_release != NULL)
+                       ops->rpc_release(data);
                return ERR_PTR(-ENOMEM);
+       }
        atomic_inc(&task->tk_count);
        rpc_execute(task);
        return task;