diff options
author | 2016-11-24 14:12:04 +0300 | |
---|---|---|
committer | 2016-11-29 21:44:01 +0100 | |
commit | 7966f2d22e2a9bb00b8b216275283d017e092fa2 (patch) | |
tree | c6d8ae33dab0fb622d894a071c669888905121ea | |
parent | Merge tag 'iio-for-4.10d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next (diff) | |
download | linux-dev-7966f2d22e2a9bb00b8b216275283d017e092fa2.tar.xz linux-dev-7966f2d22e2a9bb00b8b216275283d017e092fa2.zip |
staging: lustre/ptlrpc: small leak on allocation failure
We should free "desc" before returning NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/client.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index ac959ef1fab0..804741362bc0 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; } |