summaryrefslogtreecommitdiffstats
path: root/xlators/features/snapview-server
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2014-06-04 18:43:36 +0530
committerVijay Bellur <vbellur@redhat.com>2014-06-09 04:52:27 -0700
commit9707d98ab2e5252307f83104966cd2d318b6434c (patch)
tree6ef66bbd7319abc0fe864e47e561683afa2823d2 /xlators/features/snapview-server
parente95dcdc3193cd33d98349d92218e438e5e37cebc (diff)
snapview-server: coverity fixes
Change-Id: If4c866b1155bedabd5cf65dae22fa565b7440938 BUG: 1094815 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/7975 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/snapview-server')
-rw-r--r--xlators/features/snapview-server/src/snapview-server.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
index 928f8ee..6ef0e7a 100644
--- a/xlators/features/snapview-server/src/snapview-server.c
+++ b/xlators/features/snapview-server/src/snapview-server.c
@@ -521,7 +521,7 @@ svs_get_latest_snap_entry (xlator_t *this)
dirents = priv->dirents;
- if (priv->num_snaps) {
+ if (priv->num_snaps && dirents) {
tmp_dirent = &dirents[priv->num_snaps - 1];
dirent = tmp_dirent;
}
@@ -604,8 +604,8 @@ svs_lookup_entry_point (xlator_t *this, loc_t *loc, inode_t *parent,
}
}
}
- op_ret = 0;
- goto out;
+
+ op_ret = 0;
out:
return op_ret;
@@ -690,7 +690,7 @@ svs_lookup_gfid (xlator_t *this, loc_t *loc, struct iatt *buf,
}
iatt_from_stat (buf, &statbuf);
- if (loc->gfid)
+ if (!uuid_is_null (loc->gfid))
uuid_copy (buf->ia_gfid, loc->gfid);
else
uuid_copy (buf->ia_gfid, loc->inode->gfid);
@@ -995,7 +995,7 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
/* Initialize latest snapshot, which is used for nameless lookups */
dirent = svs_get_latest_snap_entry (this);
- if (!dirent->fs)
+ if (dirent && !dirent->fs)
fs = svs_initialise_snapshot_volume (this, dirent->name);
/* lookup is on the entry point to the snapshot world */
@@ -1155,7 +1155,7 @@ svs_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name,
fs = inode_ctx->fs;
object = inode_ctx->object;
size = glfs_h_getxattrs (fs, object, name, NULL, 0);
- if (!size == -1) {
+ if (size == -1) {
gf_log (this->name, GF_LOG_ERROR, "getxattr on %s "
"failed (key: %s)", loc->name, name);
op_ret = -1;
@@ -1262,7 +1262,7 @@ svs_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
if (inode_ctx->type == SNAP_VIEW_VIRTUAL_INODE) {
size = glfs_fgetxattr (glfd, name, NULL, 0);
- if (!size == -1) {
+ if (size == -1) {
gf_log (this->name, GF_LOG_ERROR, "getxattr on %s "
"failed (key: %s)", uuid_utoa (fd->inode->gfid),
name);
@@ -1497,6 +1497,9 @@ svs_get_snapshot_list (xlator_t *this, svs_private_t *priv)
ret = 0;
out:
+ if (ret)
+ GF_FREE (dirents);
+
return ret;
}