diff options
author | Anoop C S <achiraya@redhat.com> | 2015-04-15 13:01:51 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-23 22:56:57 -0700 |
commit | 2e16e383128707806cecd9027088cde573ff182d (patch) | |
tree | 97ef7618df31274809d60713d126932e36d375e2 /xlators/features/trash | |
parent | 272b55b54b3f760f0b95b29ec37ed719852ce4ed (diff) |
features/trash: Minor coverity fixes
CID 1288784
CID 1288785
CID 1288795
CID 1288796
CID 1288797
CID 1288802
Change-Id: I51dd7653a2dce3b7b6387e5d91c1c07eb157a04b
BUG: 789278
Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-on: http://review.gluster.org/10315
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System
Tested-by: jiffin tony Thottan <jthottan@redhat.com>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators/features/trash')
-rw-r--r-- | xlators/features/trash/src/trash.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index 07492e3addf..5cc051004b4 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -1559,6 +1559,10 @@ trash_truncate_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* Creating vaild parent and pargfids for both files */ + if (dir_entry == NULL) { + ret = EINVAL; + goto out; + } local->loc.parent = inode_ref (dir_entry->parent); gf_uuid_copy (local->loc.pargfid, dir_entry->parent->gfid); @@ -1916,6 +1920,12 @@ reconfigure (xlator_t *this, dict_t *options) goto out; } frame = create_frame (this, this->ctx->pool); + if (frame == NULL) { + gf_log (this->name, GF_LOG_ERROR, + "failed to create frame"); + ret = ENOMEM; + goto out; + } /* assign new location values to new_loc members */ gf_uuid_copy (new_loc.gfid, trash_gfid); @@ -1960,8 +1970,7 @@ reconfigure (xlator_t *this, dict_t *options) FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, &old_loc, &new_loc, options); - if (priv->oldtrash_dir) - GF_FREE (priv->oldtrash_dir); + GF_FREE (priv->oldtrash_dir); priv->oldtrash_dir = gf_strdup(priv->newtrash_dir); if (!priv->oldtrash_dir) { @@ -2038,6 +2047,13 @@ notify (xlator_t *this, int event, void *data, ...) /* Check whether posix is up not */ if (event == GF_EVENT_CHILD_UP) { frame = create_frame(this, this->ctx->pool); + if (frame == NULL) { + gf_log (this->name, GF_LOG_ERROR, + "failed to create frame"); + ret = ENOMEM; + goto out; + } + dict = dict_new (); if (!dict) { ret = ENOMEM; @@ -2067,6 +2083,10 @@ notify (xlator_t *this, int event, void *data, ...) loc_wipe (&loc); } + if (priv->oldtrash_dir == NULL) { + ret = EINVAL; + goto out; + } if (strcmp (priv->oldtrash_dir, priv->newtrash_dir) == 0) { gf_log (this->name, GF_LOG_DEBUG, "Creating trash " "directory %s from notify", @@ -2163,8 +2183,7 @@ notify (xlator_t *this, int event, void *data, ...) FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, &old_loc, &loc, dict); - if (priv->oldtrash_dir) - GF_FREE (priv->oldtrash_dir); + GF_FREE (priv->oldtrash_dir); priv->oldtrash_dir = gf_strdup(priv->newtrash_dir); if (!priv->oldtrash_dir) { |