[PATCH 1/6] afs: fix memory leak

Yuanhan Liu yliu.null at gmail.com
Fri Jun 22 12:09:01 EDT 2012


Fix memory leak in case call->buffer kmalloc failed.

Signed-off-by: Yuanhan Liu <yliu.null at gmail.com>
---
 fs/afs/rxrpc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 8ad8c2a..8bfd65c 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -212,13 +212,15 @@ struct afs_call *afs_alloc_flat_call(const struct afs_call_type *type,
 	if (reply_size) {
 		call->buffer = kmalloc(reply_size, GFP_NOFS);
 		if (!call->buffer)
-			goto nomem_free;
+			goto free_request;
 	}
 
 	init_waitqueue_head(&call->waitq);
 	skb_queue_head_init(&call->rx_queue);
 	return call;
 
+free_request:
+	kfree(call->request);
 nomem_free:
 	afs_free_call(call);
 nomem_call:
-- 
1.7.4.4




More information about the linux-afs mailing list