kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] staging: lustre/ptlrpc:  small leak on allocation failure
@ 2016-11-24 11:12 Dan Carpenter
  2016-11-25 23:16 ` [lustre-devel] " Dilger, Andreas
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-11-24 11:12 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Andreas Dilger, James Simmons, Greg Kroah-Hartman, Liang Zhen,
	Vitaly Fertman, frank zago, Sebastien Buisson, Amir Shehata,
	Niu Yawei, lustre-devel, devel, linux-kernel, kernel-janitors

We should free "desc" before returning NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index ac959ef..8047413 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -128,12 +128,12 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int nfrags,
 		GET_KIOV(desc) = kcalloc(nfrags, sizeof(*GET_KIOV(desc)),
 					 GFP_NOFS);
 		if (!GET_KIOV(desc))
-			goto out;
+			goto free_desc;
 	} else {
 		GET_KVEC(desc) = kcalloc(nfrags, sizeof(*GET_KVEC(desc)),
 					 GFP_NOFS);
 		if (!GET_KVEC(desc))
-			goto out;
+			goto free_desc;
 	}
 
 	spin_lock_init(&desc->bd_lock);
@@ -154,7 +154,8 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int nfrags,
 		LNetInvalidateHandle(&desc->bd_mds[i]);
 
 	return desc;
-out:
+free_desc:
+	kfree(desc);
 	return NULL;
 }
 

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

end of thread, other threads:[~2016-11-25 23:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 11:12 [patch] staging: lustre/ptlrpc: small leak on allocation failure Dan Carpenter
2016-11-25 23:16 ` [lustre-devel] " Dilger, Andreas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).