diff options
| author | Anoop C S <achiraya@redhat.com> | 2015-04-15 13:01:51 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-26 23:25:28 -0700 | 
| commit | f2026fd6d5993fa5d57ccb7b0add832cef14e09c (patch) | |
| tree | 54abec4387ba23ffddcd12ea55ab002bc1c27533 | |
| parent | bc01c573e810b82efd59c4ffc5feeeaf2d4c72b5 (diff) | |
features/trash: Minor coverity fixes
        Backport of http://review.gluster.org/10315
CID 1288784
CID 1288785
CID 1288795
CID 1288796
CID 1288797
CID 1288802
Change-Id: I51dd7653a2dce3b7b6387e5d91c1c07eb157a04b
BUG: 1215026
Signed-off-by: Anoop C S <achiraya@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: jiffin tony Thottan <jthottan@redhat.com>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Reviewed-on: http://review.gluster.org/10361
Tested-by: NetBSD Build System
| -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) {  | 
