diff options
author | Michael Scherer <misc@redhat.com> | 2017-02-23 21:26:33 +0100 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2017-04-06 23:48:06 -0400 |
commit | c932c0df4b70abaa85354e56efe6f1ce88ce4a38 (patch) | |
tree | 533fc4bb21f954a43aa4257ae985d6a877159a2e /xlators/features | |
parent | 0f71338e1d7c0b70f4fe3b19c68612fe730d9de2 (diff) |
shared: simplify and fix crash when we run out of memory
Since mem_get0 can return NULL, local->op_ret is gonna
crash. Found by coverity. And since we only have ENOMEM
as potential error, we can also simplify the code by avoiding
using 'local' for that.
Change-Id: I778747b57f520b1a52347c0fc9f27efd7a7c5ca0
BUG: 789278
Signed-off-by: Michael Scherer <misc@redhat.com>
Reviewed-on: https://review.gluster.org/16739
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Michael Scherer <misc@fedoraproject.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/shard/src/shard.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 0fcbbaff3e3..074a497d0dc 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -4232,8 +4232,6 @@ shard_readdir_do (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, local = mem_get0 (this->local_pool); if (!local) { - local->op_ret = -1; - local->op_errno = ENOMEM; goto err; } @@ -4260,8 +4258,6 @@ shard_readdir_do (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, "dict value: key:%s, directory gfid=%s", GF_XATTR_SHARD_BLOCK_SIZE, uuid_utoa (fd->inode->gfid)); - local->op_ret = -1; - local->op_errno = ENOMEM; goto err; } @@ -4273,7 +4269,7 @@ shard_readdir_do (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, return 0; err: - STACK_UNWIND_STRICT (readdir, frame, local->op_ret, local->op_errno, + STACK_UNWIND_STRICT (readdir, frame, -1, ENOMEM, NULL, NULL); return 0; |