From 437455c1608a0c644d14798551c77e9513ba9901 Mon Sep 17 00:00:00 2001 From: Sunny Kumar Date: Thu, 30 Aug 2018 17:32:55 +0530 Subject: crypt : fix coverity issues in crypt.c This patch fixes CID 1356527, 1356528, 1356529, 1356530, 1395251. Change-Id: Ibdbc56a3221bff3535f02a9e73b57fcbe35c3fbd updates: bz#789278 Signed-off-by: Sunny Kumar --- xlators/encryption/crypt/src/crypt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'xlators/encryption/crypt') diff --git a/xlators/encryption/crypt/src/crypt.c b/xlators/encryption/crypt/src/crypt.c index 70087820211..f6e1823ce66 100644 --- a/xlators/encryption/crypt/src/crypt.c +++ b/xlators/encryption/crypt/src/crypt.c @@ -1121,8 +1121,10 @@ int crypt_writev(call_frame_t *frame, vec, count, 0 /* don't setup gup in tail: we don't know file size yet */); - if (ret) + if (ret) { + ret = ENOMEM; goto error; + } if (parent_is_crypt_xlator(frame, this)) { data_t *data; @@ -2188,6 +2190,7 @@ static int32_t crypt_open(call_frame_t *frame, ret = loc_copy(local->loc, loc); if (ret) { GF_FREE(local->loc); + ret = ENOMEM; goto error; } local->fd = fd_ref(fd); @@ -2574,6 +2577,7 @@ static int32_t crypt_create(call_frame_t *frame, dict_unref(local->xattr); free_inode_info(info); free_format(local); + ret = EINVAL; goto error; } ret = dict_set(local->xattr, FSIZE_XATTR_PREFIX, data_from_uint64(0)); @@ -2581,6 +2585,7 @@ static int32_t crypt_create(call_frame_t *frame, dict_unref(local->xattr); free_inode_info(info); free_format(local); + ret = ENOMEM; goto error; } local->fd = fd_ref(fd); @@ -4136,6 +4141,7 @@ static int32_t crypt_readdirp(call_frame_t *frame, xlator_t *this, ret = dict_set(xdata, FSIZE_XATTR_PREFIX, data_from_uint64(0)); if (ret) { dict_unref(xdata); + ret = ENOMEM; goto error; } STACK_WIND(frame, -- cgit