summaryrefslogtreecommitdiffstats
path: root/xlators/encryption/crypt
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2013-12-23 02:52:12 -0800
committerVijay Bellur <vbellur@redhat.com>2013-12-30 19:50:02 -0800
commit2b82cde22d808a70693d8368e1d87f91b30daf24 (patch)
treebf2181d9348adf85f3adf85ec50818c7029b663f /xlators/encryption/crypt
parenta3e3e8dee442371665996450ac3a8d2859c47cc0 (diff)
crypt: On calloc failure follow goto statement
At -------------------------------------------- 1423 if (local->vec.iov_base == NULL) { -------------------------------------------- This condition being true leads to NULL pointer to be passed into `memcpy` later at ---------------------------------------------------- 1432 memcpy((char *)local->vec.iov_base + copied, ---------------------------------------------------- Avoid this by clean exit through a goto statement with in the conditional. Change-Id: I95260767f96107aa96191b18db10908ddda82ee6 BUG: 1030058 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/6617 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/encryption/crypt')
-rw-r--r--xlators/encryption/crypt/src/crypt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xlators/encryption/crypt/src/crypt.c b/xlators/encryption/crypt/src/crypt.c
index db2e6d83cf5..47ff38e501d 100644
--- a/xlators/encryption/crypt/src/crypt.c
+++ b/xlators/encryption/crypt/src/crypt.c
@@ -1421,8 +1421,11 @@ static int32_t prune_write(call_frame_t *frame,
gf_crypt_mt_data);
if (local->vec.iov_base == NULL) {
+ gf_log(this->name, GF_LOG_WARNING,
+ "Failed to calloc head block for prune");
local->op_ret = -1;
local->op_errno = ENOMEM;
+ goto put_one_call;
}
for (i = 0; i < count; i++) {
to_copy = vec[i].iov_len;