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>
This commit is contained in:
Anoop C S 2015-04-15 13:01:51 +05:30 committed by Vijay Bellur
parent 272b55b54b
commit 2e16e38312

View File

@ -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) {