Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1529186
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [patch] staging: lustre/ptlrpc: small leak on allocation failure |
| Date | 2016-11-24 12:20 +0100 |
| Message-ID | <sH0em-1UP-27@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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;
}
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[patch] staging: lustre/ptlrpc: small leak on allocation failure Dan Carpenter <dan.carpenter@oracle.com> - 2016-11-24 12:20 +0100
csiph-web