diff options
author | Jim Meyering <meyering@redhat.com> | 2012-07-13 10:29:48 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-13 14:03:42 -0700 |
commit | 7820b2c1f88b207a8b1270b8c3cb3b797b7563d2 (patch) | |
tree | 5a383d85eb18399cf7506a90cc7627c749ccf9b8 /xlators | |
parent | 2dc0d32e5d8b205fa407073b209bb663d546dde8 (diff) |
remove useless if-before-free (and free-like) functions
See comments in http://bugzilla.redhat.com/839925 for
the code to perform this change.
Signed-off-by: Jim Meyering <meyering@redhat.com>
BUG: 839925
Change-Id: I10e4ecff16c3749fe17c2831c516737e08a3205a
Reviewed-on: http://review.gluster.com/3661
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
79 files changed, 560 insertions, 1136 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 6787dfc27..b6e160743 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -228,8 +228,7 @@ afr_inode_ctx_get_from_addr (uint64_t addr, int32_t child_count) ret = 0; out: if (ret && ctx) { - if (ctx->fresh_children) - GF_FREE (ctx->fresh_children); + GF_FREE (ctx->fresh_children); GF_FREE (ctx); ctx = NULL; } @@ -774,11 +773,9 @@ afr_local_sh_cleanup (afr_local_t *local, xlator_t *this) sh = &local->self_heal; priv = this->private; - if (sh->buf) - GF_FREE (sh->buf); + GF_FREE (sh->buf); - if (sh->parentbufs) - GF_FREE (sh->parentbufs); + GF_FREE (sh->parentbufs); if (sh->inode) inode_unref (sh->inode); @@ -788,46 +785,36 @@ afr_local_sh_cleanup (afr_local_t *local, xlator_t *this) GF_FREE (sh->xattr); } - if (sh->child_errno) - GF_FREE (sh->child_errno); + GF_FREE (sh->child_errno); afr_matrix_cleanup (sh->pending_matrix, priv->child_count); afr_matrix_cleanup (sh->delta_matrix, priv->child_count); - if (sh->sources) - GF_FREE (sh->sources); + GF_FREE (sh->sources); - if (sh->success) - GF_FREE (sh->success); + GF_FREE (sh->success); - if (sh->locked_nodes) - GF_FREE (sh->locked_nodes); + GF_FREE (sh->locked_nodes); if (sh->healing_fd) { fd_unref (sh->healing_fd); sh->healing_fd = NULL; } - if (sh->linkname) - GF_FREE ((char *)sh->linkname); + GF_FREE ((char *)sh->linkname); - if (sh->success_children) - GF_FREE (sh->success_children); + GF_FREE (sh->success_children); - if (sh->fresh_children) - GF_FREE (sh->fresh_children); + GF_FREE (sh->fresh_children); - if (sh->fresh_parent_dirs) - GF_FREE (sh->fresh_parent_dirs); + GF_FREE (sh->fresh_parent_dirs); loc_wipe (&sh->parent_loc); loc_wipe (&sh->lookup_loc); - if (sh->checksum) - GF_FREE (sh->checksum); + GF_FREE (sh->checksum); - if (sh->write_needed) - GF_FREE (sh->write_needed); + GF_FREE (sh->write_needed); if (sh->healing_fd) fd_unref (sh->healing_fd); } @@ -844,17 +831,13 @@ afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this) afr_matrix_cleanup (local->transaction.txn_changelog, priv->child_count); - if (local->internal_lock.locked_nodes) - GF_FREE (local->internal_lock.locked_nodes); + GF_FREE (local->internal_lock.locked_nodes); - if (local->internal_lock.inode_locked_nodes) - GF_FREE (local->internal_lock.inode_locked_nodes); + GF_FREE (local->internal_lock.inode_locked_nodes); - if (local->internal_lock.entry_locked_nodes) - GF_FREE (local->internal_lock.entry_locked_nodes); + GF_FREE (local->internal_lock.entry_locked_nodes); - if (local->internal_lock.lower_locked_nodes) - GF_FREE (local->internal_lock.lower_locked_nodes); + GF_FREE (local->internal_lock.lower_locked_nodes); GF_FREE (local->transaction.pre_op); @@ -894,17 +877,13 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this) if (local->dict) dict_unref (local->dict); - if (local->child_up) - GF_FREE (local->child_up); + GF_FREE (local->child_up); - if (local->child_errno) - GF_FREE (local->child_errno); + GF_FREE (local->child_errno); - if (local->fresh_children) - GF_FREE (local->fresh_children); + GF_FREE (local->fresh_children); - if (local->fd_open_on) - GF_FREE (local->fd_open_on); + GF_FREE (local->fd_open_on); { /* lookup */ if (local->cont.lookup.xattrs) { @@ -922,27 +901,21 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this) inode_unref (local->cont.lookup.inode); } - if (local->cont.lookup.postparents) - GF_FREE (local->cont.lookup.postparents); + GF_FREE (local->cont.lookup.postparents); - if (local->cont.lookup.bufs) - GF_FREE (local->cont.lookup.bufs); + GF_FREE (local->cont.lookup.bufs); - if (local->cont.lookup.success_children) - GF_FREE (local->cont.lookup.success_children); + GF_FREE (local->cont.lookup.success_children); - if (local->cont.lookup.sources) - GF_FREE (local->cont.lookup.sources); + GF_FREE (local->cont.lookup.sources); } { /* getxattr */ - if (local->cont.getxattr.name) - GF_FREE (local->cont.getxattr.name); + GF_FREE (local->cont.getxattr.name); } { /* lk */ - if (local->cont.lk.locked_nodes) - GF_FREE (local->cont.lk.locked_nodes); + GF_FREE (local->cont.lk.locked_nodes); } { /* create */ @@ -997,8 +970,7 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this) } { /* opendir */ - if (local->cont.opendir.checksum) - GF_FREE (local->cont.opendir.checksum); + GF_FREE (local->cont.opendir.checksum); } { /* readdirp */ @@ -2632,28 +2604,22 @@ afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd) fd_ctx = (afr_fd_ctx_t *)(long) ctx; if (fd_ctx) { - if (fd_ctx->pre_op_done) - GF_FREE (fd_ctx->pre_op_done); + GF_FREE (fd_ctx->pre_op_done); - if (fd_ctx->opened_on) - GF_FREE (fd_ctx->opened_on); + GF_FREE (fd_ctx->opened_on); - if (fd_ctx->locked_on) - GF_FREE (fd_ctx->locked_on); + GF_FREE (fd_ctx->locked_on); - if (fd_ctx->pre_op_piggyback) - GF_FREE (fd_ctx->pre_op_piggyback); + GF_FREE (fd_ctx->pre_op_piggyback); list_for_each_entry_safe (paused_call, tmp, &fd_ctx->paused_calls, call_list) { list_del_init (&paused_call->call_list); GF_FREE (paused_call); } - if (fd_ctx->lock_piggyback) - GF_FREE (fd_ctx->lock_piggyback); + GF_FREE (fd_ctx->lock_piggyback); - if (fd_ctx->lock_acquired) - GF_FREE (fd_ctx->lock_acquired); + GF_FREE (fd_ctx->lock_acquired); pthread_mutex_destroy (&fd_ctx->delay_lock); @@ -3615,8 +3581,7 @@ afr_forget (xlator_t *this, inode_t *inode) goto out; ctx = (afr_inode_ctx_t *)(long)ctx_addr; - if (ctx->fresh_children) - GF_FREE (ctx->fresh_children); + GF_FREE (ctx->fresh_children); GF_FREE (ctx); out: return 0; diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 0b804bef5..ca2c3a235 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -67,8 +67,7 @@ afr_build_parent_loc (loc_t *parent, loc_t *child, int32_t *op_errno) ret = 0; out: - if (child_path) - GF_FREE(child_path); + GF_FREE(child_path); return ret; } diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 02e36b13a..6ea288a5e 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -429,8 +429,7 @@ unlock: afr_fix_open (frame, this, fd_ctx, need_open_count, need_open); fop_continue = _gf_false; out: - if (need_open) - GF_FREE (need_open); + GF_FREE (need_open); if (fop_continue && local->fop_call_continue) local->fop_call_continue (frame, this); return ret; diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index 18edca8c1..201e12c52 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -63,8 +63,7 @@ sh_private_cleanup (call_frame_t *frame, xlator_t *this) sh = &local->self_heal; sh_priv = sh->private; - if (sh_priv) - GF_FREE (sh_priv); + GF_FREE (sh_priv); } static int diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index c4384ebc5..b5b4627f6 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -474,8 +474,7 @@ afr_mark_biggest_of_fools_as_source (int32_t *sources, int32_t **pending_matrix, characters, child_count, biggest_witness); out: - if (witnesses) - GF_FREE (witnesses); + GF_FREE (witnesses); return nsources; } diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 7186da710..2edee5fd4 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -988,8 +988,7 @@ afr_sh_data_fstat (call_frame_t *frame, xlator_t *this) } GF_ASSERT (!call_count); out: - if (fstat_children) - GF_FREE (fstat_children); + GF_FREE (fstat_children); return 0; } @@ -1130,8 +1129,7 @@ out: dict_unref (xattr_req); if (ret) { - if (zero_pending) - GF_FREE (zero_pending); + GF_FREE (zero_pending); afr_sh_data_fail (frame, this); } diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index c5deb18b8..6184036b2 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -85,8 +85,7 @@ shd_cleanup_event (void *event) if (!shd_event) goto out; - if (shd_event->path) - GF_FREE (shd_event->path); + GF_FREE (shd_event->path); GF_FREE (shd_event); out: return; diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index c4378d445..2144f483f 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -414,8 +414,7 @@ afr_transaction_rm_stale_children (call_frame_t *frame, xlator_t *this, afr_inode_rm_stale_children (this, inode, stale_children); out: - if (stale_children) - GF_FREE (stale_children); + GF_FREE (stale_children); return; } diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index eb3f84789..ff42d8dc1 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -996,8 +996,7 @@ out: if (dict) dict_unref (dict); - if (dict_str) - GF_FREE (dict_str); + GF_FREE (dict_str); return 0; } diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index eaafc2bfb..51e2c37ae 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1784,8 +1784,7 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ret = dict_set_dynstr (dict, local->xsel, xattr_buf); - if (local->xattr_val) - GF_FREE (local->xattr_val); + GF_FREE (local->xattr_val); DHT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, xdata); diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 611de19e4..f0e74a154 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -120,10 +120,8 @@ dht_filter_loc_subvol_key (xlator_t *this, loc_t *loc, loc_t *new_loc, out: if (!ret) { /* !success */ - if (new_path) - GF_FREE (new_path); - if (new_name) - GF_FREE (new_name); + GF_FREE (new_path); + GF_FREE (new_name); } return ret; } @@ -206,16 +204,11 @@ dht_local_wipe (xlator_t *this, dht_local_t *local) local->selfheal.layout = NULL; } - if (local->newpath) { - GF_FREE (local->newpath); - } + GF_FREE (local->newpath); - if (local->key) { - GF_FREE (local->key); - } + GF_FREE (local->key); - if (local->rebalance.vector) - GF_FREE (local->rebalance.vector); + GF_FREE (local->rebalance.vector); if (local->rebalance.iobref) iobref_unref (local->rebalance.iobref); @@ -750,8 +743,7 @@ dht_migration_complete_check_task (void *data) tmp_loc.path = path; ret = syncop_open (dst_node, &tmp_loc, local->fd->flags, local->fd); - if (path) - GF_FREE (path); + GF_FREE (path); } if (ret == -1) { @@ -874,8 +866,7 @@ dht_rebalance_inprogress_task (void *data) tmp_loc.path = path; ret = syncop_open (dst_node, &tmp_loc, local->fd->flags, local->fd); - if (path) - GF_FREE (path); + GF_FREE (path); } if (ret == -1) { diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index d2a59cc43..e33875ffc 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -408,8 +408,7 @@ __dht_rebalance_migrate_data (xlator_t *from, xlator_t *to, fd_t *src, fd_t *dst offset += ret; total += ret; - if (vector) - GF_FREE (vector); + GF_FREE (vector); if (iobref) iobref_unref (iobref); iobref = NULL; @@ -417,8 +416,7 @@ __dht_rebalance_migrate_data (xlator_t *from, xlator_t *to, fd_t *src, fd_t *dst } if (iobref) iobref_unref (iobref); - if (vector) - GF_FREE (vector); + GF_FREE (vector); if (ret >= 0) ret = 0; diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 7ceb80157..8b7d15ce5 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -182,8 +182,7 @@ err: if (xattr) dict_destroy (xattr); - if (disk_layout) - GF_FREE (disk_layout); + GF_FREE (disk_layout); dht_selfheal_dir_xattr_cbk (frame, subvol, frame->this, -1, ENOMEM, NULL); @@ -703,8 +702,7 @@ done: local->layout = new_layout; } - if (fix_array) - GF_FREE (fix_array); + GF_FREE (fix_array); return local->layout; } diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index c51285442..6b156c1d3 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -213,11 +213,9 @@ fini (xlator_t *this) GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); GF_FREE (conf); } @@ -280,8 +278,7 @@ dht_parse_decommissioned_bricks (xlator_t *this, dht_conf_t *conf, ret = 0; conf->decommission_in_progress = 1; out: - if (dup_brick) - GF_FREE (dup_brick); + GF_FREE (dup_brick); return ret; } @@ -483,17 +480,13 @@ err: GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); - if (conf->du_stats) - GF_FREE (conf->du_stats); + GF_FREE (conf->du_stats); - if (conf->defrag) - GF_FREE (conf->defrag); + GF_FREE (conf->defrag); GF_FREE (conf); } diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 2179870d9..53c66aa45 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -481,11 +481,9 @@ fini (xlator_t *this) GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); GF_FREE (conf); } @@ -629,14 +627,11 @@ err: GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); - if (conf->du_stats) - GF_FREE (conf->du_stats); + GF_FREE (conf->du_stats); GF_FREE (conf); } diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index ab261da87..0542d7f9a 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -95,8 +95,7 @@ get_switch_matching_subvol (const char *path, dht_conf_t *conf, trav = trav->next; } out: - if (pathname) - GF_FREE (pathname); + GF_FREE (pathname); return subvol; } @@ -589,8 +588,7 @@ fini (xlator_t *this) trav = (struct switch_struct *)conf->private; conf->private = NULL; while (trav) { - if (trav->array) - GF_FREE (trav->array); + GF_FREE (trav->array); prev = trav; trav = trav->next; GF_FREE (prev); @@ -603,11 +601,9 @@ fini (xlator_t *this) GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); GF_FREE (conf); } @@ -822,16 +818,13 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf, return 0; err: - if (switch_buf_array) - GF_FREE (switch_buf_array); - if (switch_opt) - GF_FREE (switch_opt); + GF_FREE (switch_buf_array); + GF_FREE (switch_opt); if (switch_buf) { trav = switch_buf; while (trav) { - if (trav->array) - GF_FREE (trav->array); + GF_FREE (trav->array); switch_opt = trav; trav = trav->next; GF_FREE (switch_opt); @@ -954,14 +947,11 @@ err: GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); - if (conf->du_stats) - GF_FREE (conf->du_stats); + GF_FREE (conf->du_stats); GF_FREE (conf); } diff --git a/xlators/cluster/ha/src/ha.c b/xlators/cluster/ha/src/ha.c index 38d4229d3..e7956b826 100644 --- a/xlators/cluster/ha/src/ha.c +++ b/xlators/cluster/ha/src/ha.c @@ -1876,13 +1876,9 @@ err: } if (hafdp) { - if (hafdp->fdstate) { - GF_FREE (hafdp->fdstate); - } + GF_FREE (hafdp->fdstate); - if (hafdp->path) { - GF_FREE (hafdp->path); - } + GF_FREE (hafdp->path); GF_FREE (hafdp); } diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index ead9da0b9..06d629a7e 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -2375,8 +2375,7 @@ fini (xlator_t *this) priv = this->private; if (priv) { - if (priv->xlarray) - GF_FREE (priv->xlarray); + GF_FREE (priv->xlarray); trav_map = priv->map; while (trav_map) { diff --git a/xlators/cluster/stripe/src/stripe-helpers.c b/xlators/cluster/stripe/src/stripe-helpers.c index 336da793e..8053f871a 100644 --- a/xlators/cluster/stripe/src/stripe-helpers.c +++ b/xlators/cluster/stripe/src/stripe-helpers.c @@ -508,11 +508,9 @@ set_stripe_block_size (xlator_t *this, stripe_private_t *priv, char *data) ret = 0; out: - if (dup_str) - GF_FREE (dup_str); + GF_FREE (dup_str); - if (stripe_opt) - GF_FREE (stripe_opt); + GF_FREE (stripe_opt); return ret; } diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index efee9444e..6aae3da44 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -3265,8 +3265,7 @@ stripe_readv_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, count, &tmp_stbuf, tmp_iobref, NULL); iobref_unref (tmp_iobref); - if (vec) - GF_FREE (vec); + GF_FREE (vec); } out: return 0; @@ -3399,8 +3398,7 @@ stripe_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, final_count, &tmp_stbuf, tmp_iobref, NULL); iobref_unref (tmp_iobref); - if (final_vec) - GF_FREE (final_vec); + GF_FREE (final_vec); } goto out; @@ -4489,8 +4487,7 @@ init (xlator_t *this) out: if (ret) { if (priv) { - if (priv->xl_array) - GF_FREE (priv->xl_array); + GF_FREE (priv->xl_array); GF_FREE (priv); } } @@ -4514,8 +4511,7 @@ fini (xlator_t *this) priv = this->private; if (priv) { this->private = NULL; - if (priv->xl_array) - GF_FREE (priv->xl_array); + GF_FREE (priv->xl_array); trav = priv->pattern; while (trav) { @@ -4699,8 +4695,7 @@ stripe_vgetxattr_cbk (call_frame_t *frame, void *cookie, ret = stripe_free_xattr_str (local); - if (local->xattr_list) - GF_FREE (local->xattr_list); + GF_FREE (local->xattr_list); if (stripe_xattr) dict_unref (stripe_xattr); diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 2cf28f1cc..1057ace85 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1541,8 +1541,7 @@ io_stats_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, unwind: /* local is assigned with path */ - if (frame->local) - GF_FREE (frame->local); + GF_FREE (frame->local); frame->local = NULL; STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf, preparent, postparent, xdata); @@ -2435,8 +2434,7 @@ io_stats_release (xlator_t *this, fd_t *fd) if (iosfd) { io_stats_dump_fd (this, iosfd); - if (iosfd->filename) - GF_FREE (iosfd->filename); + GF_FREE (iosfd->filename); GF_FREE (iosfd); } @@ -2524,8 +2522,7 @@ ios_destroy_top_stats (struct ios_conf *conf) stat = list->iosstat; ios_stat_unref (stat); list_del (&list->list); - if (list) - GF_FREE (list); + GF_FREE (list); list_head->members--; } } @@ -2540,8 +2537,7 @@ ios_destroy_top_stats (struct ios_conf *conf) stat = list->iosstat; ios_stat_unref (stat); list_del (&list->list); - if (list) - GF_FREE (list); + GF_FREE (list); list_head->members--; } } @@ -2699,8 +2695,7 @@ fini (xlator_t *this) ios_destroy_top_stats (conf); - if (conf) - GF_FREE(conf); + GF_FREE(conf); gf_log (this->name, GF_LOG_INFO, "io-stats translator unloaded"); diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index a1136a2e5..97f61ca59 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -105,12 +105,9 @@ trace_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uuid_utoa (inode->gfid), op_ret, fd, statstr, preparentstr, postparentstr); - if (statstr) - GF_FREE (statstr); - if (preparentstr) - GF_FREE (preparentstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (statstr); + GF_FREE (preparentstr); + GF_FREE (postparentstr); /* for 'release' log */ fd_ctx_set (fd, this, 0); @@ -162,8 +159,7 @@ trace_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (frame->local), op_ret, statstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d)", @@ -192,8 +188,7 @@ trace_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (frame->local), op_ret, statstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d)", @@ -228,11 +223,9 @@ trace_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, preopstr, postopstr); - if (preopstr) - GF_FREE (preopstr); + GF_FREE (preopstr); - if (postopstr) - GF_FREE (postopstr); + GF_FREE (postopstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d", @@ -301,11 +294,9 @@ trace_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, preopstr, postopstr); - if (preopstr) - GF_FREE (preopstr); + GF_FREE (preopstr); - if (postopstr) - GF_FREE (postopstr); + GF_FREE (postopstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d", @@ -340,11 +331,9 @@ trace_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, preopstr, postopstr); - if (preopstr) - GF_FREE (preopstr); + GF_FREE (preopstr); - if (postopstr) - GF_FREE (postopstr); + GF_FREE (postopstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d)", @@ -377,11 +366,9 @@ trace_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, preopstr, postopstr); - if (preopstr) - GF_FREE (preopstr); + GF_FREE (preopstr); - if (postopstr) - GF_FREE (postopstr); + GF_FREE (postopstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d)", @@ -415,11 +402,9 @@ trace_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (frame->local), op_ret, preparentstr, postparentstr); - if (preparentstr) - GF_FREE (preparentstr); + GF_FREE (preparentstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (postparentstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d)", @@ -463,20 +448,15 @@ trace_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, preoldparentstr, postoldparentstr, prenewparentstr, postnewparentstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); - if (preoldparentstr) - GF_FREE (preoldparentstr); + GF_FREE (preoldparentstr); - if (postoldparentstr) - GF_FREE (postoldparentstr); + GF_FREE (postoldparentstr); - if (prenewparentstr) - GF_FREE (prenewparentstr); + GF_FREE (prenewparentstr); - if (postnewparentstr) - GF_FREE (postnewparentstr); + GF_FREE (postnewparentstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d", @@ -515,8 +495,7 @@ trace_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (frame->local), op_ret, op_errno); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); } frame->local = NULL; @@ -545,10 +524,8 @@ trace_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (inode->gfid), op_ret, statstr, postparentstr); - if (statstr) - GF_FREE (statstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (statstr); + GF_FREE (postparentstr); /* For 'forget' */ inode_ctx_put (inode, this, 0); @@ -590,14 +567,11 @@ trace_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (inode->gfid), op_ret, statstr, preparentstr, postparentstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); - if (preparentstr) - GF_FREE (preparentstr); + GF_FREE (preparentstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (postparentstr); } else { gf_log (this->name, GF_LOG_INFO, @@ -636,14 +610,11 @@ trace_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (inode->gfid), op_ret, statstr, preparentstr, postparentstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); - if (preparentstr) - GF_FREE (preparentstr); + GF_FREE (preparentstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (postparentstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -681,14 +652,11 @@ trace_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (inode->gfid), op_ret, statstr, preparentstr, postparentstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); - if (preparentstr) - GF_FREE (preparentstr); + GF_FREE (preparentstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (postparentstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -725,14 +693,11 @@ trace_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, statstr, preparentstr, postparentstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); - if (preparentstr) - GF_FREE (preparentstr); + GF_FREE (preparentstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (postparentstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d", @@ -805,11 +770,9 @@ trace_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (frame->local), op_ret, preparentstr, postparentstr); - if (preparentstr) - GF_FREE (preparentstr); + GF_FREE (preparentstr); - if (postparentstr) - GF_FREE (postparentstr); + GF_FREE (postparentstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d", @@ -844,11 +807,9 @@ trace_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, preopstr, postopstr); - if (preopstr) - GF_FREE (preopstr); + GF_FREE (preopstr); - if (postopstr) - GF_FREE (postopstr); + GF_FREE (postopstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d", @@ -1029,11 +990,9 @@ trace_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, prebufstr, postbufstr); - if (prebufstr) - GF_FREE (prebufstr); + GF_FREE (prebufstr); - if (postbufstr) - GF_FREE (postbufstr); + GF_FREE (postbufstr); } else { gf_log (this->name, GF_LOG_INFO, @@ -1063,8 +1022,7 @@ trace_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, uuid_utoa (frame->local), op_ret, statstr); - if (statstr) - GF_FREE (statstr); + GF_FREE (statstr); } else { gf_log (this->name, GF_LOG_INFO, "%"PRId64": gfid=%s op_ret=%d, op_errno=%d", diff --git a/xlators/features/locks/src/clear.c b/xlators/features/locks/src/clear.c index 5533c6bdc..015a9fe72 100644 --- a/xlators/features/locks/src/clear.c +++ b/xlators/features/locks/src/clear.c @@ -149,8 +149,7 @@ clrlk_parse_args (const char* cmd, clrlk_args *args) ret = 0; out: - if (free_ptr) - GF_FREE (free_ptr); + GF_FREE (free_ptr); return ret; } diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index f59d0882c..542043fe1 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -182,8 +182,7 @@ pl_print_lockee (char *str, int size, fd_t *fd, loc_t *loc) uuid_utoa (inode->gfid), fd, ipath ? ipath : "<nul>"); - if (ipath) - GF_FREE (ipath); + GF_FREE (ipath); } diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c index 2a47657db..2c4904ff3 100644 --- a/xlators/features/locks/src/entrylk.c +++ b/xlators/features/locks/src/entrylk.c @@ -341,8 +341,7 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type, if (conf) { ret = -EAGAIN; if (nonblock){ - if (lock->basename) - GF_FREE ((char *)lock->basename); + GF_FREE ((char *)lock->basename); GF_FREE (lock); goto out; @@ -361,8 +360,7 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type, if ( __blocked_lock_conflict (dom, basename, type) && !(__owner_has_lock (dom, lock))) { ret = -EAGAIN; if (nonblock) { - if (lock->basename) - GF_FREE ((char *) lock->basename); + GF_FREE ((char *) lock->basename); GF_FREE (lock); goto out; @@ -499,8 +497,7 @@ __grant_blocked_entry_locks (xlator_t *this, pl_inode_t *pl_inode, } else { gf_log (this->name, GF_LOG_DEBUG, "should never happen"); - if (bl->basename) - GF_FREE ((char *)bl->basename); + GF_FREE ((char *)bl->basename); GF_FREE (bl); } } @@ -601,8 +598,7 @@ release_entry_locks_for_transport (xlator_t *this, pl_inode_t *pinode, STACK_UNWIND_STRICT (entrylk, lock->frame, -1, EAGAIN, NULL); - if (lock->basename) - GF_FREE ((char *)lock->basename); + GF_FREE ((char *)lock->basename); GF_FREE (lock); } @@ -612,8 +608,7 @@ release_entry_locks_for_transport (xlator_t *this, pl_inode_t *pinode, STACK_UNWIND_STRICT (entrylk, lock->frame, 0, 0, NULL); - if (lock->basename) - GF_FREE ((char *)lock->basename); + GF_FREE ((char *)lock->basename); GF_FREE (lock); } diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c index a2e65d55f..eba85795c 100644 --- a/xlators/features/locks/src/inodelk.c +++ b/xlators/features/locks/src/inodelk.c @@ -454,8 +454,7 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom, __pl_inodelk_unref (l); } } - if (path) - GF_FREE (path); + GF_FREE (path); pthread_mutex_unlock (&pinode->mutex); diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 3da40ffac..09ce63774 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -476,8 +476,7 @@ pl_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, out: STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata); - if (args.opts) - GF_FREE (args.opts); + GF_FREE (args.opts); if (op_ret && lk_summary) GF_FREE (lk_summary); if (dict) @@ -1351,8 +1350,7 @@ pl_forget (xlator_t *this, list_for_each_entry_safe (entry_l, entry_tmp, &dom->entrylk_list, domain_list) { list_del_init (&entry_l->domain_list); - if (entry_l->basename) - GF_FREE ((char *)entry_l->basename); + GF_FREE ((char *)entry_l->basename); GF_FREE (entry_l); } @@ -1385,8 +1383,7 @@ pl_forget (xlator_t *this, list_for_each_entry_safe (entry_l, entry_tmp, &entrylks_released, blocked_locks) { STACK_UNWIND_STRICT (entrylk, entry_l->frame, -1, 0, NULL); - if (entry_l->basename) - GF_FREE ((char *)entry_l->basename); + GF_FREE ((char *)entry_l->basename); GF_FREE (entry_l); } @@ -2033,8 +2030,7 @@ pl_dump_inode_priv (xlator_t *this, inode_t *inode) } out: - if (pathname) - GF_FREE (pathname); + GF_FREE (pathname); return ret; } @@ -2120,8 +2116,7 @@ init (xlator_t *this) out: if (ret) { - if (priv) - GF_FREE (priv); + GF_FREE (priv); } return ret; } diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 534437479..1b5abd572 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -117,8 +117,7 @@ err: if (parent) inode_unref (parent); - if (resolvedpath) - GF_FREE (resolvedpath); + GF_FREE (resolvedpath); return ret; } @@ -2419,14 +2418,11 @@ marker_xtime_priv_cleanup (xlator_t *this) GF_VALIDATE_OR_GOTO (this->name, priv, out); - if (priv->volume_uuid != NULL) - GF_FREE (priv->volume_uuid); + GF_FREE (priv->volume_uuid); - if (priv->timestamp_file != NULL) - GF_FREE (priv->timestamp_file); + GF_FREE (priv->timestamp_file); - if (priv->marker_xattr != NULL) - GF_FREE (priv->marker_xattr); + GF_FREE (priv->marker_xattr); out: return; } diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c index f2423092e..22ec8fe1e 100644 --- a/xlators/features/path-convertor/src/path.c +++ b/xlators/features/path-convertor/src/path.c @@ -848,8 +848,7 @@ path_setxattr (call_frame_t *frame, if (tmp_path != loc_path) GF_FREE (tmp_path); - if (tmp_name) - GF_FREE (tmp_name); + GF_FREE (tmp_name); return 0; } diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c index d355a19fa..423ec6ffb 100644 --- a/xlators/features/quiesce/src/quiesce.c +++ b/xlators/features/quiesce/src/quiesce.c @@ -41,16 +41,13 @@ gf_quiesce_local_wipe (xlator_t *this, quiesce_local_t *local) loc_wipe (&local->loc); if (local->fd) fd_unref (local->fd); - if (local->name) - GF_FREE (local->name); - if (local->volname) - GF_FREE (local->volname); + GF_FREE (local->name); + GF_FREE (local->volname); if (local->dict) dict_unref (local->dict); if (local->iobref) iobref_unref (local->iobref); - if (local->vector) - GF_FREE (local->vector); + GF_FREE (local->vector); mem_put (local); } diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index a5ff2373f..55dd3d59d 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -497,8 +497,7 @@ quota_get_limit_value (inode_t *inode, xlator_t *this, int64_t *n) } out: - if (path) - GF_FREE (path); + GF_FREE (path); return ret; } diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index 92ea19a55..ded650271 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -170,8 +170,7 @@ trash_unlink_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, out: GF_FREE (cookie); - if (tmp_str) - GF_FREE (tmp_str); + GF_FREE (tmp_str); return 0; } @@ -442,8 +441,7 @@ trash_rename_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, out: GF_FREE (cookie); /* strdup (dir_name) was sent here :) */ - if (tmp_str) - GF_FREE (tmp_str); + GF_FREE (tmp_str); return 0; } @@ -924,8 +922,7 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, out: GF_FREE (cookie); /* strdup (dir_name) was sent here :) */ - if (tmp_str) - GF_FREE (tmp_str); + GF_FREE (tmp_str); return 0; } @@ -1287,8 +1284,7 @@ trash_ftruncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, out: GF_FREE (cookie); /* strdup (dir_name) was sent here :) */ - if (tmp_str) - GF_FREE (tmp_str); + GF_FREE (tmp_str); return 0; } @@ -1522,8 +1518,7 @@ fini (xlator_t *this) trash_private_t *priv = NULL; priv = this->private; - if (priv) - GF_FREE (priv); + GF_FREE (priv); return; } diff --git a/xlators/lib/src/libxlator.c b/xlators/lib/src/libxlator.c index 195bd5236..afa1d2ca3 100644 --- a/xlators/lib/src/libxlator.c +++ b/xlators/lib/src/libxlator.c @@ -192,8 +192,7 @@ out: dict, xdata); } - if (marker_xattr) - GF_FREE (marker_xattr); + GF_FREE (marker_xattr); return 0; } diff --git a/xlators/meta/src/tree.c b/xlators/meta/src/tree.c index cad5cbd71..2ea99fa5b 100644 --- a/xlators/meta/src/tree.c +++ b/xlators/meta/src/tree.c @@ -123,7 +123,7 @@ lookup_meta_entry (meta_dirent_t *root, const char *path, gf_asprintf (remain, "/%s/%s", *remain, piece); else gf_asprintf (remain, "/%s", piece); - if (tmp) GF_FREE (tmp); + GF_FREE (tmp); piece = strtok (NULL, "/"); } } diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index a0e24b434..640b8cb0d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -552,8 +552,7 @@ out: glusterd_friend_sm (); glusterd_op_sm (); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); //its malloced by xdr + free (cli_req.dict.dict_val); //its malloced by xdr return ret; } @@ -850,10 +849,8 @@ out: ret = 0; //sent error to cli, prevent second reply } - if (brick_list) - GF_FREE (brick_list); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); //its malloced by xdr + GF_FREE (brick_list); + free (cli_req.dict.dict_val); //its malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); @@ -972,10 +969,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, } out: - if (free_ptr1) - GF_FREE (free_ptr1); - if (free_ptr2) - GF_FREE (free_ptr2); + GF_FREE (free_ptr1); + GF_FREE (free_ptr2); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1033,8 +1028,7 @@ glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick, brickinfo->decommissioned = 1; out: - if (dup_brick) - GF_FREE (dup_brick); + GF_FREE (dup_brick); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1182,14 +1176,11 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr) } out: - if (free_ptr) - GF_FREE (free_ptr); + GF_FREE (free_ptr); if (brick_alloc && brickinfo) glusterd_brickinfo_delete (brickinfo); - if (str_ret) - GF_FREE (str_ret); - if (all_bricks) - GF_FREE (all_bricks); + GF_FREE (str_ret); + GF_FREE (all_bricks); gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 51fa993e9..4540bf3e2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -144,19 +144,16 @@ out: if (0 != ret) { if (ctx && ctx->hostname) GF_FREE (ctx->hostname); - if (ctx) - GF_FREE (ctx); + GF_FREE (ctx); if (dict) { if ((!dict->extra_stdfree) && friend_req->vols.vols_val) free (friend_req->vols.vols_val); dict_unref (dict); } else { - if (friend_req->vols.vols_val) - free (friend_req->vols.vols_val); + free (friend_req->vols.vols_val); } - if (event) - GF_FREE (event); + GF_FREE (event); } else { if (peerinfo && (0 == peerinfo->connected)) ret = GLUSTERD_CONNECTION_AWAITED; @@ -226,8 +223,7 @@ out: if (0 != ret) { if (ctx && ctx->hostname) GF_FREE (ctx->hostname); - if (ctx) - GF_FREE (ctx); + GF_FREE (ctx); } return ret; @@ -567,8 +563,7 @@ out: if (ret) { if (dict) dict_unref (dict); - if (req_ctx) - GF_FREE (req_ctx); + GF_FREE (req_ctx); } return ret; } @@ -605,8 +600,7 @@ glusterd_handle_stage_op (rpcsvc_request_t *req) ret = glusterd_op_sm_inject_event (GD_OP_EVENT_STAGE_OP, req_ctx); out: - if (op_req.buf.buf_val) - free (op_req.buf.buf_val);//malloced by xdr + free (op_req.buf.buf_val);//malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); return ret; @@ -650,8 +644,7 @@ glusterd_handle_commit_op (rpcsvc_request_t *req) ret = glusterd_op_init_ctx (op_req.op); out: - if (op_req.buf.buf_val) - free (op_req.buf.buf_val);//malloced by xdr + free (op_req.buf.buf_val);//malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); return ret; @@ -707,8 +700,7 @@ glusterd_handle_cli_probe (rpcsvc_request_t *req) ret = 0; } out: - if (cli_req.hostname) - free (cli_req.hostname);//its malloced by xdr + free (cli_req.hostname);//its malloced by xdr if (run_fsm) { glusterd_friend_sm (); @@ -787,8 +779,7 @@ out: cli_req.hostname); } - if (cli_req.hostname) - free (cli_req.hostname);//malloced by xdr + free (cli_req.hostname);//malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); @@ -1234,8 +1225,7 @@ glusterd_fsm_log_send_resp (rpcsvc_request_t *req, int op_ret, ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf1_cli_fsm_log_rsp); - if (rsp.fsm_log.fsm_log_val) - GF_FREE (rsp.fsm_log.fsm_log_val); + GF_FREE (rsp.fsm_log.fsm_log_val); gf_log ("glusterd", GF_LOG_DEBUG, "Responded, ret: %d", ret); @@ -1287,8 +1277,7 @@ glusterd_handle_fsm_log (rpcsvc_request_t *req) ret = glusterd_sm_tr_log_add_to_dict (dict, log); out: (void)glusterd_fsm_log_send_resp (req, ret, msg, dict); - if (cli_req.name) - free (cli_req.name);//malloced by xdr + free (cli_req.name);//malloced by xdr if (dict) dict_unref (dict); @@ -1415,8 +1404,7 @@ glusterd_op_stage_send_resp (rpcsvc_request_t *req, gf_log ("glusterd", GF_LOG_INFO, "Responded to stage, ret: %d", ret); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); return ret; } @@ -1457,8 +1445,7 @@ glusterd_op_commit_send_resp (rpcsvc_request_t *req, "Responded to commit, ret: %d", ret); out: - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); return ret; } @@ -1489,8 +1476,7 @@ glusterd_handle_incoming_friend_req (rpcsvc_request_t *req) } out: - if (friend_req.hostname) - free (friend_req.hostname);//malloced by xdr + free (friend_req.hostname);//malloced by xdr if (run_fsm) { glusterd_friend_sm (); @@ -1527,10 +1513,8 @@ glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req) remote_hostname, friend_req.port); out: - if (friend_req.hostname) - free (friend_req.hostname);//malloced by xdr - if (friend_req.vols.vols_val) - free (friend_req.vols.vols_val);//malloced by xdr + free (friend_req.hostname);//malloced by xdr + free (friend_req.vols.vols_val);//malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); @@ -1709,8 +1693,7 @@ out: free (friend_req.friends.friends_val);//malloced by xdr dict_unref (dict); } else { - if (friend_req.friends.friends_val) - free (friend_req.friends.friends_val);//malloced by xdr + free (friend_req.friends.friends_val);//malloced by xdr } glusterd_friend_sm (); @@ -1802,8 +1785,7 @@ respond: rsp.op_ret, rsp.op_errno, ret); out: - if (probe_req.hostname) - free (probe_req.hostname);//malloced by xdr + free (probe_req.hostname);//malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); @@ -1863,8 +1845,7 @@ out: if (ret && dict) dict_unref (dict); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); + free (cli_req.dict.dict_val); if (ret) ret = glusterd_op_send_cli_response (cli_op, ret, 0, req, NULL, "operation failed"); @@ -2380,8 +2361,7 @@ glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *hostname, int port, gf_log ("glusterd", GF_LOG_INFO, "Responded to %s (%d), ret: %d", hostname, port, ret); - if (rsp.hostname) - GF_FREE (rsp.hostname); + GF_FREE (rsp.hostname); return ret; } @@ -2488,8 +2468,7 @@ out: ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf1_cli_peer_list_rsp); - if (rsp.friends.friends_val) - GF_FREE (rsp.friends.friends_val); + GF_FREE (rsp.friends.friends_val); return ret; } @@ -2596,8 +2575,7 @@ out: if (volumes) dict_unref (volumes); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); return ret; } @@ -2663,8 +2641,7 @@ out: if (ret) ret = glusterd_op_send_cli_response (cli_op, ret, 0, req, NULL, "operation failed"); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); + free (cli_req.dict.dict_val); return ret; } @@ -2730,8 +2707,7 @@ out: if (ret) ret = glusterd_op_send_cli_response (cli_op, ret, 0, req, NULL, "operation failed"); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); + free (cli_req.dict.dict_val); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c index 2d9dd8ada..42b0ad3ea 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -113,8 +113,7 @@ build_volfile_path (const char *volname, char *path, ret = 1; out: - if (free_ptr) - GF_FREE (free_ptr); + GF_FREE (free_ptr); return ret; } @@ -213,10 +212,8 @@ fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_getspec_rsp); - if (args.key) - free (args.key);//malloced by xdr - if (rsp.spec) - free (rsp.spec); + free (args.key);//malloced by xdr + free (rsp.spec); return 0; } @@ -276,8 +273,7 @@ fail: (xdrproc_t)xdr_gf_event_notify_rsp); if (dict) dict_unref (dict); - if (args.dict.dict_val) - free (args.dict.dict_val);//malloced by xdr + free (args.dict.dict_val);//malloced by xdr return 0; } diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c index ab8e07005..7bc932468 100644 --- a/xlators/mgmt/glusterd/src/glusterd-hooks.c +++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c @@ -346,8 +346,7 @@ glusterd_hooks_run_hooks (char *hooks_path, glusterd_op_t op, dict_t *op_ctx, out: if (lines) { for (lineno = 0; lineno < line_count+1; lineno++) - if (lines[lineno]) - GF_FREE (lines[lineno]); + GF_FREE (lines[lineno]); GF_FREE (lines); } @@ -437,11 +436,9 @@ glusterd_hooks_stub_cleanup (glusterd_hooks_stub_t *stub) if (stub->op_ctx) dict_unref (stub->op_ctx); - if (stub->scriptdir) - GF_FREE (stub->scriptdir); + GF_FREE (stub->scriptdir); - if (stub) - GF_FREE (stub); + GF_FREE (stub); } static void* diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c index 2056c84b5..3ac78a917 100644 --- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c @@ -92,8 +92,7 @@ out: ret = glusterd_op_send_cli_response (cli_op, ret, 0, req, NULL, "operation failed"); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); + free (cli_req.dict.dict_val); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c index 7b4b09a6c..82fdfb81f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c +++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c @@ -697,8 +697,7 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno) *path = cookie; } - if (mtptemp) - GF_FREE (mtptemp); + GF_FREE (mtptemp); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index afe1efd47..26817d4e3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -489,8 +489,7 @@ out: if (val_dict) dict_unref (val_dict); - if (key_fixed) - GF_FREE (key_fixed); + GF_FREE (key_fixed); if (ret) { if (!(*op_errstr)) { @@ -568,8 +567,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr) } out: - if (key_fixed) - GF_FREE (key_fixed); + GF_FREE (key_fixed); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); @@ -959,8 +957,7 @@ glusterd_options_reset (glusterd_volinfo_t *volinfo, char *key, ret = 0; out: - if (key_fixed) - GF_FREE (key_fixed); + GF_FREE (key_fixed); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -1235,8 +1232,7 @@ glusterd_op_set_volume (dict_t *dict) ret = 0; out: - if (key_fixed) - GF_FREE (key_fixed); + GF_FREE (key_fixed); gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index cef89b49a..75c72abcc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -228,8 +228,7 @@ pmap_registry_bind (xlator_t *this, int port, const char *brickname, p = port; pmap->ports[p].type = type; - if (pmap->ports[p].brickname) - free (pmap->ports[p].brickname); + free (pmap->ports[p].brickname); pmap->ports[p].brickname = strdup (brickname); pmap->ports[p].type = type; pmap->ports[p].xprt = xprt; @@ -281,8 +280,7 @@ remove: gf_log ("pmap", GF_LOG_INFO, "removing brick %s on port %d", pmap->ports[p].brickname, p); - if (pmap->ports[p].brickname) - free (pmap->ports[p].brickname); + free (pmap->ports[p].brickname); pmap->ports[p].brickname = NULL; pmap->ports[p].xprt = NULL; @@ -317,8 +315,7 @@ gluster_pmap_portbybrick (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_pmap_port_by_brick_rsp); - if (args.brick) - free (args.brick);//malloced by xdr + free (args.brick);//malloced by xdr return 0; } @@ -377,8 +374,7 @@ gluster_pmap_signup (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_pmap_signup_rsp); - if (args.brick) - free (args.brick);//malloced by xdr + free (args.brick);//malloced by xdr return 0; } @@ -405,8 +401,7 @@ gluster_pmap_signin (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_pmap_signin_rsp); - if (args.brick) - free (args.brick);//malloced by xdr + free (args.brick);//malloced by xdr if (!ret) glusterd_brick_update_signin (brickinfo, _gf_true); @@ -439,8 +434,7 @@ gluster_pmap_signout (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_pmap_signout_rsp); - if (args.brick) - free (args.brick);//malloced by xdr + free (args.brick);//malloced by xdr if (!ret) glusterd_brick_update_signin (brickinfo, _gf_false); diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index b063421ec..8d034c455 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -237,8 +237,7 @@ _glusterd_quota_remove_limits (char **quota_limits, char *path, } out: - if (limits) - GF_FREE (limits); + GF_FREE (limits); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index e57e687c3..c9397b394 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -199,8 +199,7 @@ glusterd_defrag_notify (struct rpc_clnt *rpc, void *mydata, if (defrag->cbk_fn) defrag->cbk_fn (volinfo, volinfo->defrag_status); - if (defrag) - GF_FREE (defrag); + GF_FREE (defrag); gf_log ("", GF_LOG_DEBUG, "%s got RPC_CLNT_DISCONNECT", rpc->conn.trans->name); break; @@ -487,8 +486,7 @@ out: NULL, "operation failed"); } - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val);//malloced by xdr + free (cli_req.dict.dict_val);//malloced by xdr return 0; } diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index 067196952..5bd6a55b9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -156,8 +156,7 @@ glusterd_handle_replace_brick (rpcsvc_request_t *req) out: if (ret && dict) dict_unref (dict); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val);//malloced by xdr + free (cli_req.dict.dict_val);//malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); @@ -500,8 +499,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, ret = 0; out: - if (dup_dstbrick) - GF_FREE (dup_dstbrick); + GF_FREE (dup_dstbrick); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index f5863117e..7937235be 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -185,8 +185,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, ret = glusterd_submit_reply (req, cli_rsp, NULL, 0, NULL, xdrproc); - if (free_ptr) - GF_FREE (free_ptr); + GF_FREE (free_ptr); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -288,8 +287,7 @@ glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("glusterd", GF_LOG_INFO, "Received resp to probe req"); out: - if (rsp.hostname) - free (rsp.hostname);//malloced by xdr + free (rsp.hostname);//malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -382,8 +380,7 @@ out: } if (ctx) glusterd_destroy_probe_ctx (ctx); - if (rsp.hostname) - free (rsp.hostname);//malloced by xdr + free (rsp.hostname);//malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -477,8 +474,7 @@ respond: glusterd_destroy_probe_ctx (ctx); } - if (rsp.hostname) - free (rsp.hostname);//malloced by xdr + free (rsp.hostname);//malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -925,15 +921,13 @@ out: glusterd_op_sm (); } - if (rsp.op_errstr) - free (rsp.op_errstr); //malloced by xdr + free (rsp.op_errstr); //malloced by xdr if (dict) { if (!dict->extra_stdfree && rsp.dict.dict_val) free (rsp.dict.dict_val); //malloced by xdr dict_unref (dict); } else { - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); //malloced by xdr + free (rsp.dict.dict_val); //malloced by xdr } GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; @@ -1422,8 +1416,7 @@ out: if (dict) dict_unref (dict); - if (rsp.op_errstr) - free (rsp.op_errstr); //malloced by xdr + free (rsp.op_errstr); //malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -1472,8 +1465,7 @@ glusterd_rpc_probe (call_frame_t *frame, xlator_t *this, (xdrproc_t)xdr_gd1_mgmt_probe_req); out: - if (req.hostname) - GF_FREE (req.hostname); + GF_FREE (req.hostname); gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -1523,8 +1515,7 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this, out: - if (req.vols.vols_val) - GF_FREE (req.vols.vols_val); + GF_FREE (req.vols.vols_val); if (vols) dict_unref (vols); @@ -1606,8 +1597,7 @@ glusterd_rpc_friend_update (call_frame_t *frame, xlator_t *this, (xdrproc_t)xdr_gd1_mgmt_friend_update); out: - if (req.friends.friends_val) - GF_FREE (req.friends.friends_val); + GF_FREE (req.friends.friends_val); gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1882,8 +1872,7 @@ out: if (ret && dict) dict_unref (dict); - if (rsp.op_errstr) - free (rsp.op_errstr); //malloced by xdr + free (rsp.op_errstr); //malloced by xdr GLUSTERD_STACK_DESTROY (frame); return ret; } @@ -1951,8 +1940,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, opinfo.brick_pending_count = 0; ret = 0; if (req) { - if (req->input.input_val) - GF_FREE (req->input.input_val); + GF_FREE (req->input.input_val); GF_FREE (req); req = NULL; } @@ -1979,8 +1967,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, this, glusterd_brick_op_cbk, (xdrproc_t)xdr_gd1_mgmt_brick_op_req); if (req) { - if (req->input.input_val) - GF_FREE (req->input.input_val); + GF_FREE (req->input.input_val); GF_FREE (req); req = NULL; } diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index 1fe78a149..951277f63 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -100,8 +100,7 @@ glusterd_destroy_probe_ctx (glusterd_probe_ctx_t *ctx) if (!ctx) return; - if (ctx->hostname) - GF_FREE (ctx->hostname); + GF_FREE (ctx->hostname); GF_FREE (ctx); } @@ -113,8 +112,7 @@ glusterd_destroy_friend_req_ctx (glusterd_friend_req_ctx_t *ctx) if (ctx->vols) dict_unref (ctx->vols); - if (ctx->hostname) - GF_FREE (ctx->hostname); + GF_FREE (ctx->hostname); GF_FREE (ctx); } @@ -123,8 +121,7 @@ glusterd_destroy_friend_update_ctx (glusterd_friend_update_ctx_t *ctx) { if (!ctx) return; - if (ctx->hostname) - GF_FREE (ctx->hostname); + GF_FREE (ctx->hostname); GF_FREE (ctx); } @@ -257,12 +254,9 @@ glusterd_ac_reverse_probe_begin (glusterd_friend_sm_event_t *event, void *ctx) out: if (ret) { - if (new_event) - GF_FREE (new_event); - if (new_ev_ctx->hostname) - GF_FREE (new_ev_ctx->hostname); - if (new_ev_ctx) - GF_FREE (new_ev_ctx); + GF_FREE (new_event); + GF_FREE (new_ev_ctx->hostname); + GF_FREE (new_ev_ctx); } gf_log ("", GF_LOG_DEBUG, "returning with %d", ret); return ret; diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index a70256c39..6d707878a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -1222,8 +1222,7 @@ out: handle->read = NULL; } - if (free_str) - GF_FREE (free_str); + GF_FREE (free_str); return ret; } @@ -1304,11 +1303,8 @@ out: close (fd); if (ret == -1) { - if (spath) - GF_FREE (spath); - if (shandle) { - GF_FREE (shandle); - } + GF_FREE (spath); + GF_FREE (shandle); } gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); @@ -1454,8 +1450,7 @@ glusterd_retrieve_uuid () uuid_parse (uuid_str, priv->uuid); out: - if (uuid_str) - GF_FREE (uuid_str); + GF_FREE (uuid_str); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -1616,8 +1611,7 @@ out: *value = NULL; } } - if (free_str) - GF_FREE (free_str); + GF_FREE (free_str); if (op_errno) *op_errno = store_errno; diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 2b2e9d2e6..629829283 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -306,8 +306,7 @@ gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, uuid_t my_uuid, uuid_t recv_uuid, if (args.errstr && errstr) *errstr = args.errstr; - else if (args.errstr) - GF_FREE (args.errstr); + else GF_FREE (args.errstr); if (args.dict && dict_in) *dict_in = args.dict; @@ -406,8 +405,7 @@ gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, uuid_t my_uuid, uuid_t recv_uuid if (args.errstr && errstr) *errstr = args.errstr; - else if (args.errstr) - GF_FREE (args.errstr); + else GF_FREE (args.errstr); if (args.dict && dict_in) *dict_in = args.dict; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index ab1156178..feb81d8de 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -561,16 +561,14 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo) new_volinfo->dict = dict_new (); if (!new_volinfo->dict) { - if (new_volinfo) - GF_FREE (new_volinfo); + GF_FREE (new_volinfo); goto out; } new_volinfo->gsync_slaves = dict_new (); if (!new_volinfo->gsync_slaves) { - if (new_volinfo) - GF_FREE (new_volinfo); + GF_FREE (new_volinfo); goto out; } @@ -591,11 +589,9 @@ glusterd_auth_cleanup (glusterd_volinfo_t *volinfo) { GF_ASSERT (volinfo); - if (volinfo->auth.username) - GF_FREE (volinfo->auth.username); + GF_FREE (volinfo->auth.username); - if (volinfo->auth.password) - GF_FREE (volinfo->auth.password); + GF_FREE (volinfo->auth.password); } char * @@ -643,8 +639,7 @@ glusterd_brickinfo_delete (glusterd_brickinfo_t *brickinfo) list_del_init (&brickinfo->brick_list); - if (brickinfo->logfile) - GF_FREE (brickinfo->logfile); + GF_FREE (brickinfo->logfile); GF_FREE (brickinfo); ret = 0; @@ -689,8 +684,7 @@ glusterd_volinfo_delete (glusterd_volinfo_t *volinfo) dict_unref (volinfo->dict); if (volinfo->gsync_slaves) dict_unref (volinfo->gsync_slaves); - if (volinfo->logdir) - GF_FREE (volinfo->logdir); + GF_FREE (volinfo->logdir); glusterd_auth_cleanup (volinfo); @@ -779,8 +773,7 @@ glusterd_brickinfo_from_brick (char *brick, ret = 0; out: - if (tmp_host) - GF_FREE (tmp_host); + GF_FREE (tmp_host); if (tmp_host) GF_FREE (tmp_path); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); @@ -877,10 +870,8 @@ glusterd_volume_brickinfo_get_by_brick (char *brick, ret = glusterd_volume_brickinfo_get (NULL, hostname, path, volinfo, brickinfo, path_match); out: - if (tmp_host) - GF_FREE (tmp_host); - if (tmp_path) - GF_FREE (tmp_path); + GF_FREE (tmp_host); + GF_FREE (tmp_path); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -917,8 +908,7 @@ glusterd_friend_cleanup (glusterd_peerinfo_t *peerinfo) peerinfo->rpc = rpc_clnt_unref (peerinfo->rpc); peerinfo->rpc = NULL; if (peerctx) { - if (peerctx->errstr) - GF_FREE (peerctx->errstr); + GF_FREE (peerctx->errstr); GF_FREE (peerctx); } } @@ -1482,8 +1472,7 @@ glusterd_sort_and_redirect (const char *src_filepath, int dest_fd) ret = 0; out: - if (lines) - GF_FREE (lines); + GF_FREE (lines); return ret; } @@ -3148,8 +3137,7 @@ glusterd_remote_hostname_get (rpcsvc_request_t *req, char *remote_host, int len) out: - if (tmp_host) - GF_FREE (tmp_host); + GF_FREE (tmp_host); return ret; } @@ -3635,8 +3623,7 @@ glusterd_get_brick_root (char *path, char **mount_point) return 0; err: - if (*mount_point) - GF_FREE (*mount_point); + GF_FREE (*mount_point); return -1; } @@ -3818,8 +3805,7 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo, ret = dict_set_dynstr (dict, key, mnt_options); out: - if (mnt_pt) - GF_FREE (mnt_pt); + GF_FREE (mnt_pt); return ret; } #endif @@ -4667,8 +4653,7 @@ glusterd_sm_tr_log_delete (glusterd_sm_tr_log_t *log) { if (!log) return; - if (log->transitions) - GF_FREE (log->transitions); + GF_FREE (log->transitions); return; } @@ -4766,8 +4751,7 @@ glusterd_peer_destroy (glusterd_peerinfo_t *peerinfo) } list_del_init (&peerinfo->uuid_list); - if (peerinfo->hostname) - GF_FREE (peerinfo->hostname); + GF_FREE (peerinfo->hostname); glusterd_sm_tr_log_delete (&peerinfo->sm_log); GF_FREE (peerinfo); peerinfo = NULL; @@ -5078,8 +5062,7 @@ glusterd_set_dump_options (char *dumpoptions_path, char *options, out: if (fp) fclose (fp); - if (dup_options) - GF_FREE (dup_options); + GF_FREE (dup_options); return ret; } @@ -5231,8 +5214,7 @@ out: if (pidfile) fclose (pidfile); unlink (dumpoptions_path); - if (dup_options) - GF_FREE (dup_options); + GF_FREE (dup_options); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index c7924e5c2..1e22560aa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -295,8 +295,7 @@ xlator_instantiate_va (const char *type, const char *format, va_list arg) error: gf_log ("", GF_LOG_ERROR, "creating xlator of type %s failed", type); - if (volname) - GF_FREE (volname); + GF_FREE (volname); if (xl) xlator_destroy (xl); @@ -619,8 +618,7 @@ volopt_trie (char *key, char **hint) } out: - if (patt[0]) - GF_FREE (patt[0]); + GF_FREE (patt[0]); if (ret) *hint = NULL; @@ -1244,8 +1242,7 @@ volgen_write_volfile (volgen_graph_t *graph, char *filename) error: - if (ftmp) - GF_FREE (ftmp); + GF_FREE (ftmp); if (f) fclose (f); @@ -2407,8 +2404,7 @@ volgen_graph_build_dht_cluster (volgen_graph_t *graph, } ret = 0; out: - if (decommissioned_children) - GF_FREE (decommissioned_children); + GF_FREE (decommissioned_children); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 0bbadad3d..f706ac674 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -234,8 +234,7 @@ out: ret = 0; //Client response sent, prevent second response } - if (free_ptr) - GF_FREE(free_ptr); + GF_FREE(free_ptr); glusterd_volume_brickinfos_delete (&tmpvolinfo); if (brickinfo) @@ -299,8 +298,7 @@ glusterd_handle_cli_start_volume (rpcsvc_request_t *req) out: if (ret && dict) dict_unref (dict); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); //its malloced by xdr + free (cli_req.dict.dict_val); //its malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); @@ -362,8 +360,7 @@ glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) ((ret)?"FAILED":"SUCCESS")); out: - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); //its malloced by xdr + free (cli_req.dict.dict_val); //its malloced by xdr glusterd_friend_sm (); glusterd_op_sm (); @@ -429,8 +426,7 @@ glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) ((ret) ? "FAILED" : "SUCCESS")); out: - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); //its malloced by xdr + free (cli_req.dict.dict_val); //its malloced by xdr if (ret && dict) dict_unref (dict); @@ -594,8 +590,7 @@ glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) out: if (ret && dict) dict_unref (dict); - if (cli_req.dict.dict_val) - free (cli_req.dict.dict_val); + free (cli_req.dict.dict_val); glusterd_friend_sm (); glusterd_op_sm(); @@ -731,8 +726,7 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr) brick_info = NULL; } out: - if (free_ptr) - GF_FREE (free_ptr); + GF_FREE (free_ptr); if (brick_info) glusterd_brickinfo_delete (brick_info); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); @@ -1437,8 +1431,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) list_add_tail (&volinfo->vol_list, &priv->volumes); vol_added = _gf_true; out: - if (free_ptr) - GF_FREE(free_ptr); + GF_FREE(free_ptr); if (!vol_added && volinfo) glusterd_volinfo_delete (volinfo); return ret; @@ -1932,11 +1925,9 @@ out: GF_FREE (xl_opts); } - if (cmd_str) - GF_FREE (cmd_str); + GF_FREE (cmd_str); - if (mntpt) - GF_FREE (mntpt); + GF_FREE (mntpt); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index a3869e631..87914ee49 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -1061,8 +1061,7 @@ fini (xlator_t *this) goto out; conf = this->private; - if (conf->pmap) - FREE (conf->pmap); + FREE (conf->pmap); if (conf->handle) glusterd_store_handle_destroy (conf->handle); glusterd_sm_tr_log_delete (&conf->op_sm_log); diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 21e14efb3..360e1443c 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2444,8 +2444,7 @@ fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, out: free_fuse_state (state); STACK_DESTROY (frame->root); - if (buf) - GF_FREE (buf); + GF_FREE (buf); return 0; } @@ -4687,8 +4686,7 @@ cleanup_exit: close (priv->fuse_dump_fd); GF_FREE (priv); } - if (mnt_args) - GF_FREE (mnt_args); + GF_FREE (mnt_args); return -1; } diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index feec23998..bcad97fc7 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -31,14 +31,11 @@ static void fuse_resolve_wipe (fuse_resolve_t *resolve) { - if (resolve->path) - GF_FREE ((void *)resolve->path); + GF_FREE ((void *)resolve->path); - if (resolve->bname) - GF_FREE ((void *)resolve->bname); + GF_FREE ((void *)resolve->bname); - if (resolve->resolved) - GF_FREE ((void *)resolve->resolved); + GF_FREE ((void *)resolve->resolved); if (resolve->fd) fd_unref (resolve->fd); diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index e85f82ad5..aafabf4ae 100644 --- a/xlators/nfs/server/src/mount3.c +++ b/xlators/nfs/server/src/mount3.c @@ -1584,8 +1584,7 @@ __mnt3_init_volume_direxports (struct mount3_state *ms, xlator_t *xlator, ret = 0; err: - if (dupopt) - GF_FREE (dupopt); + GF_FREE (dupopt); return ret; } diff --git a/xlators/nfs/server/src/mount3udp_svc.c b/xlators/nfs/server/src/mount3udp_svc.c index 2c370a74a..aa38b1cc4 100644 --- a/xlators/nfs/server/src/mount3udp_svc.c +++ b/xlators/nfs/server/src/mount3udp_svc.c @@ -78,12 +78,9 @@ mountudpproc3_mnt_3_svc(dirpath **dpp, struct svc_req *req) return res; err: - if (fh) - GF_FREE (fh); - if (res) - GF_FREE (res); - if (autharr) - GF_FREE (autharr); + GF_FREE (fh); + GF_FREE (res); + GF_FREE (autharr); return NULL; } diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c index 21093d711..d35df87bc 100644 --- a/xlators/nfs/server/src/nfs-common.c +++ b/xlators/nfs/server/src/nfs-common.c @@ -235,8 +235,7 @@ err: if (parent) inode_unref (parent); - if (resolvedpath) - GF_FREE (resolvedpath); + GF_FREE (resolvedpath); return ret; } @@ -397,8 +396,7 @@ err: if (entryinode) inode_unref (entryinode); - if (resolvedpath) - GF_FREE (resolvedpath); + GF_FREE (resolvedpath); return ret; } diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 684123958..9b8af7df8 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -448,11 +448,9 @@ nfs3_call_state_wipe (nfs3_call_state_t *cs) fd_unref (cs->fd); } - if (cs->resolventry) - GF_FREE (cs->resolventry); + GF_FREE (cs->resolventry); - if (cs->pathname) - GF_FREE (cs->pathname); + GF_FREE (cs->pathname); if (!list_empty (&cs->entries.list)) gf_dirent_free (&cs->entries); diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index 9a0cd020a..6399cb043 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -1916,8 +1916,7 @@ nlm4_create_share_reservation (nfs3_call_state_t *cs) out: if (ret && inode) { inode_unref (inode); - if (share) - GF_FREE (share); + GF_FREE (share); } UNLOCK (&nlm_client_list_lk); diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index bdaf0f1b8..6062f9a68 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -1495,13 +1495,9 @@ ioc_get_priority_list (const char *opt_str, struct list_head *first) stripe_str = strtok_r (NULL, ",", &tmp_str); } out: - if (string != NULL) { - GF_FREE (string); - } + GF_FREE (string); - if (dup_str != NULL) { - GF_FREE (dup_str); - } + GF_FREE (dup_str); if (max_pri == -1) { list_for_each_entry_safe (curr, tmp, first, list) { diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index cf1aee9d6..55923990d 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -222,8 +222,7 @@ mdc_local_wipe (xlator_t *this, mdc_local_t *local) if (local->fd) fd_unref (local->fd); - if (local->linkname) - GF_FREE (local->linkname); + GF_FREE (local->linkname); if (local->xattr) dict_unref (local->xattr); @@ -249,8 +248,7 @@ mdc_inode_wipe (xlator_t *this, inode_t *inode) if (mdc->xattr) dict_unref (mdc->xattr); - if (mdc->linkname) - GF_FREE (mdc->linkname); + GF_FREE (mdc->linkname); GF_FREE (mdc); diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 6e4ce816e..349ea7789 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -29,9 +29,7 @@ qr_local_free (qr_local_t *local) call_stub_destroy (local->stub); } - if (local->path != NULL) { - GF_FREE (local->path); - } + GF_FREE (local->path); mem_put (local); @@ -1371,9 +1369,7 @@ out: } ret: - if (vector) { - GF_FREE (vector); - } + GF_FREE (vector); if (iobref) { iobref_unref (iobref); @@ -3754,13 +3750,9 @@ qr_get_priority_list (const char *opt_str, struct list_head *first) priority_str = strtok_r (NULL, ",", &tmp_str); } out: - if (string != NULL) { - GF_FREE (string); - } + GF_FREE (string); - if (dup_str != NULL) { - GF_FREE (dup_str); - } + GF_FREE (dup_str); if (max_pri == -1) { list_for_each_entry_safe (curr, tmp, first, list) { diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 61a07d04e..7b23049d3 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -1071,9 +1071,7 @@ init (xlator_t *this) out: if (ret == -1) { - if (conf != NULL) { - GF_FREE (conf); - } + GF_FREE (conf); } return ret; diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index 2e1b7a9be..3b5fbc252 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -137,8 +137,7 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf, err: if (sc) { - if (sc->readlink) - FREE (sc->readlink); + FREE (sc->readlink); sc->readlink = NULL; FREE (sc); } diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index a743039d9..81a254df6 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -577,9 +577,7 @@ out: iobref_unref (iobref); } - if (vector != NULL) { - GF_FREE (vector); - } + GF_FREE (vector); if (bytes == -1) { /* @@ -2963,8 +2961,7 @@ init (xlator_t *this) out: if (ret) { - if (conf) - GF_FREE (conf); + GF_FREE (conf); } return ret; } diff --git a/xlators/protocol/auth/addr/src/addr.c b/xlators/protocol/auth/addr/src/addr.c index 3551ec760..199fc6db0 100644 --- a/xlators/protocol/auth/addr/src/addr.c +++ b/xlators/protocol/auth/addr/src/addr.c @@ -218,8 +218,7 @@ gf_auth (dict_t *input_params, dict_t *config_params) } out: - if (addr_cpy) - GF_FREE (addr_cpy); + GF_FREE (addr_cpy); return result; } diff --git a/xlators/protocol/auth/login/src/login.c b/xlators/protocol/auth/login/src/login.c index 838cb4262..702a876ac 100644 --- a/xlators/protocol/auth/login/src/login.c +++ b/xlators/protocol/auth/login/src/login.c @@ -121,8 +121,7 @@ auth_result_t gf_auth (dict_t *input_params, dict_t *config_params) } out: - if (username_cpy) - GF_FREE (username_cpy); + GF_FREE (username_cpy); return result; } diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index f32fe1713..3242cf0ae 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -347,8 +347,7 @@ out: rsp.spec); /* Don't use 'GF_FREE', this is allocated by libc */ - if (rsp.spec) - free (rsp.spec); + free (rsp.spec); return 0; } @@ -1460,8 +1459,7 @@ out: ret = 0; } - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); STACK_DESTROY (frame->root); @@ -1582,8 +1580,7 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) (xdrproc_t)xdr_gf_setvolume_req); fail: - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c index a0a006123..77b416c47 100644 --- a/xlators/protocol/client/src/client-helpers.c +++ b/xlators/protocol/client/src/client-helpers.c @@ -133,9 +133,7 @@ client_local_wipe (clnt_local_t *local) iobref_unref (local->iobref); } - if (local->name) { - GF_FREE (local->name); - } + GF_FREE (local->name); mem_put (local); } diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 66f93c73b..d541c35eb 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -193,8 +193,7 @@ out: gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -264,8 +263,7 @@ out: gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -333,8 +331,7 @@ out: gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -476,8 +473,7 @@ out: CLIENT_STACK_UNWIND (open, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), fd, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -532,8 +528,7 @@ out: CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &iatt, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -590,11 +585,9 @@ out: /* This is allocated by the libc while decoding RPC msg */ /* Hence no 'GF_FREE', but just 'free' */ - if (rsp.path) - free (rsp.path); + free (rsp.path); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -650,8 +643,7 @@ out: gf_error_to_errno (rsp.op_errno), &preparent, &postparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -707,8 +699,7 @@ out: gf_error_to_errno (rsp.op_errno), &preparent, &postparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -765,8 +756,7 @@ out: gf_error_to_errno (rsp.op_errno), &prestat, &poststat, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -820,8 +810,7 @@ out: CLIENT_STACK_UNWIND (statfs, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &statfs, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -879,8 +868,7 @@ out: gf_error_to_errno (rsp.op_errno), &prestat, &poststat, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -938,8 +926,7 @@ out: CLIENT_STACK_UNWIND (flush, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -996,8 +983,7 @@ out: gf_error_to_errno (rsp.op_errno), &prestat, &poststat, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1048,8 +1034,7 @@ out: } CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, op_errno, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1117,11 +1102,9 @@ out: CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata); /* don't use GF_FREE, this memory was allocated by libc */ - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1185,11 +1168,9 @@ out: CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1241,8 +1222,7 @@ out: CLIENT_STACK_UNWIND (removexattr, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1291,8 +1271,7 @@ out: CLIENT_STACK_UNWIND (fremovexattr, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1340,8 +1319,7 @@ out: CLIENT_STACK_UNWIND (fsyncdir, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1389,8 +1367,7 @@ out: CLIENT_STACK_UNWIND (access, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1447,8 +1424,7 @@ out: gf_error_to_errno (rsp.op_errno), &prestat, &poststat, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1501,8 +1477,7 @@ out: CLIENT_STACK_UNWIND (fstat, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &stat, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1552,8 +1527,7 @@ out: CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1602,8 +1576,7 @@ out: CLIENT_STACK_UNWIND (finodelk, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1653,8 +1626,7 @@ out: CLIENT_STACK_UNWIND (entrylk, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1704,8 +1676,7 @@ out: CLIENT_STACK_UNWIND (fentrylk, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1770,11 +1741,9 @@ out: CLIENT_STACK_UNWIND (xattrop, frame, rsp.op_ret, gf_error_to_errno (op_errno), dict, xdata); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1838,11 +1807,9 @@ out: CLIENT_STACK_UNWIND (fxattrop, frame, rsp.op_ret, gf_error_to_errno (op_errno), dict, xdata); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1896,8 +1863,7 @@ out: CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, op_errno, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -1953,8 +1919,7 @@ out: gf_error_to_errno (rsp.op_errno), &prestat, &poststat, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2012,8 +1977,7 @@ out: gf_error_to_errno (rsp.op_errno), &prestat, &poststat, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2091,8 +2055,7 @@ out: gf_error_to_errno (rsp.op_errno), fd, inode, &stbuf, &preparent, &postparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2151,8 +2114,7 @@ out: free (rsp.strong_checksum.strong_checksum_val); } - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2224,11 +2186,9 @@ out: CLIENT_STACK_UNWIND (lk, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &lock, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); - if (rsp.flock.lk_owner.lk_owner_val) - free (rsp.flock.lk_owner.lk_owner_val); + free (rsp.flock.lk_owner.lk_owner_val); if (xdata) dict_unref (xdata); @@ -2291,8 +2251,7 @@ out: gf_dirent_free (&entries); } - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2355,8 +2314,7 @@ out: if (rsp.op_ret != -1) { gf_dirent_free (&entries); } - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2424,8 +2382,7 @@ out: &stbuf, &preoldparent, &postoldparent, &prenewparent, &postnewparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2496,8 +2453,7 @@ out: gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2567,8 +2523,7 @@ out: CLIENT_STACK_UNWIND (opendir, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), fd, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -2658,8 +2613,7 @@ out: if (xdata) dict_unref (xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); return 0; } @@ -2726,8 +2680,7 @@ out: gf_error_to_errno (rsp.op_errno), vector, rspcount, &stat, iobref, xdata); - if (rsp.xdata.xdata_val) - free (rsp.xdata.xdata_val); + free (rsp.xdata.xdata_val); if (xdata) dict_unref (xdata); @@ -3012,8 +2965,7 @@ client3_3_lookup (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobref) iobref_unref (rsp_iobref); @@ -3027,8 +2979,7 @@ unwind: CLIENT_STACK_UNWIND (lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobref) iobref_unref (rsp_iobref); @@ -3077,15 +3028,13 @@ client3_3_stat (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3133,14 +3082,12 @@ client3_3_truncate (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3182,14 +3129,12 @@ client3_3_ftruncate (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (ftruncate, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3238,14 +3183,12 @@ client3_3_access (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (access, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3326,8 +3269,7 @@ client3_3_readlink (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: @@ -3336,8 +3278,7 @@ unwind: } CLIENT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3386,14 +3327,12 @@ client3_3_unlink (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (unlink, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3440,14 +3379,12 @@ client3_3_rmdir (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (rmdir, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3508,8 +3445,7 @@ client3_3_symlink (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: @@ -3517,8 +3453,7 @@ unwind: CLIENT_STACK_UNWIND (symlink, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3575,16 +3510,14 @@ client3_3_rename (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (rename, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3651,14 +3584,12 @@ client3_3_link (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3718,16 +3649,14 @@ client3_3_mknod (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (mknod, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3787,16 +3716,14 @@ client3_3_mkdir (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3858,16 +3785,14 @@ client3_3_create (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (create, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3926,15 +3851,13 @@ client3_3_open (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (open, frame, -1, op_errno, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4022,8 +3945,7 @@ client3_3_readv (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -4040,8 +3962,7 @@ unwind: iobref_unref (rsp_iobref); CLIENT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4097,15 +4018,13 @@ client3_3_writev (call_frame_t *frame, xlator_t *this, void *data) gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4157,16 +4076,14 @@ client3_3_flush (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (flush, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4208,15 +4125,13 @@ client3_3_fsync (call_frame_t *frame, xlator_t *this, } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (fsync, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4256,15 +4171,13 @@ client3_3_fstat (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (fstat, frame, -1, op_errno, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4321,16 +4234,14 @@ client3_3_opendir (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (opendir, frame, -1, op_errno, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4373,15 +4284,13 @@ client3_3_fsyncdir (call_frame_t *frame, xlator_t *this, void *data) gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (fsyncdir, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4431,15 +4340,13 @@ client3_3_statfs (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (statfs, frame, -1, op_errno, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4493,20 +4400,16 @@ client3_3_setxattr (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4554,20 +4457,16 @@ client3_3_fsetxattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4653,8 +4552,7 @@ client3_3_fgetxattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -4672,8 +4570,7 @@ unwind: if (rsp_iobref) iobref_unref (rsp_iobref); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4795,8 +4692,7 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -4814,8 +4710,7 @@ unwind: CLIENT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4909,11 +4804,9 @@ client3_3_xattrop (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -4925,9 +4818,7 @@ client3_3_xattrop (call_frame_t *frame, xlator_t *this, unwind: CLIENT_STACK_UNWIND (xattrop, frame, -1, op_errno, NULL, NULL); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + GF_FREE (req.dict.dict_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -4935,8 +4826,7 @@ unwind: if (rsp_iobref) iobref_unref (rsp_iobref); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5022,11 +4912,9 @@ client3_3_fxattrop (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -5038,8 +4926,7 @@ client3_3_fxattrop (call_frame_t *frame, xlator_t *this, unwind: CLIENT_STACK_UNWIND (fxattrop, frame, -1, op_errno, NULL, NULL); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); if (rsp_iobref) iobref_unref (rsp_iobref); @@ -5047,8 +4934,7 @@ unwind: if (rsp_iobuf) iobuf_unref (rsp_iobuf); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5096,14 +4982,12 @@ client3_3_removexattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5147,14 +5031,12 @@ client3_3_fremovexattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (fremovexattr, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5229,14 +5111,12 @@ client3_3_lk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (lk, frame, -1, op_errno, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5313,14 +5193,12 @@ client3_3_inodelk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (inodelk, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5391,13 +5269,11 @@ client3_3_finodelk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (finodelk, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5452,14 +5328,12 @@ client3_3_entrylk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (entrylk, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5508,14 +5382,12 @@ client3_3_fentrylk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (fentrylk, frame, -1, op_errno, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5557,14 +5429,12 @@ client3_3_rchecksum (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5656,8 +5526,7 @@ client3_3_readdir (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -5675,8 +5544,7 @@ unwind: iobuf_unref (rsp_iobuf); CLIENT_STACK_UNWIND (readdir, frame, -1, op_errno, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5768,8 +5636,7 @@ client3_3_readdirp (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); if (rsp_iobuf) iobuf_unref (rsp_iobuf); @@ -5785,8 +5652,7 @@ unwind: if (rsp_iobuf) iobuf_unref (rsp_iobuf); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); CLIENT_STACK_UNWIND (readdirp, frame, -1, op_errno, NULL, NULL); return 0; @@ -5836,14 +5702,12 @@ client3_3_setattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (setattr, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } @@ -5882,14 +5746,12 @@ client3_3_fsetattr (call_frame_t *frame, xlator_t *this, void *data) gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; unwind: CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL); - if (req.xdata.xdata_val) - GF_FREE (req.xdata.xdata_val); + GF_FREE (req.xdata.xdata_val); return 0; } diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 77111ec34..16c7dee5e 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1269,8 +1269,7 @@ client_set_remote_options (char *value, xlator_t *this) ret = _gf_true; out: - if (dup_value) - GF_FREE (dup_value); + GF_FREE (dup_value); return ret; } diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index b429eb6b2..04662b403 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -669,19 +669,15 @@ fail: (xdrproc_t)xdr_gf_setvolume_rsp); - if (args.dict.dict_val) - free (args.dict.dict_val); + free (args.dict.dict_val); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); dict_unref (params); dict_unref (reply); dict_unref (config_params); - if (buf) { - GF_FREE (buf); - } + GF_FREE (buf); return 0; } @@ -737,9 +733,7 @@ fail: server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_set_lk_ver_rsp); - if (args.uid != NULL) { - free (args.uid); - } + free (args.uid); return 0; } diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 284b44145..3a7bb4aea 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -61,19 +61,16 @@ server_loc_wipe (loc_t *loc) loc->inode = NULL; } - if (loc->path) - GF_FREE ((void *)loc->path); + GF_FREE ((void *)loc->path); } void server_resolve_wipe (server_resolve_t *resolve) { - if (resolve->path) - GF_FREE ((void *)resolve->path); + GF_FREE ((void *)resolve->path); - if (resolve->bname) - GF_FREE ((void *)resolve->bname); + GF_FREE ((void *)resolve->bname); loc_wipe (&resolve->resolve_loc); } @@ -121,11 +118,9 @@ free_state (server_state_t *state) state->xdata = NULL; } - if (state->volume) - GF_FREE ((void *)state->volume); + GF_FREE ((void *)state->volume); - if (state->name) - GF_FREE ((void *)state->name); + GF_FREE ((void *)state->name); server_loc_wipe (&state->loc); server_loc_wipe (&state->loc2); @@ -528,8 +523,7 @@ do_connection_cleanup (xlator_t *this, server_connection_t *conn, } state = CALL_STATE (frame); - if (state) - GF_FREE (state); + GF_FREE (state); STACK_DESTROY (frame->root); @@ -1294,8 +1288,7 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp) ret = 0; out: - if (trav) - GF_FREE (trav); + GF_FREE (trav); return ret; } @@ -1361,8 +1354,7 @@ readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp) prev = trav; while (trav) { trav = trav->nextentry; - if (prev->dict.dict_val) - GF_FREE (prev->dict.dict_val); + GF_FREE (prev->dict.dict_val); GF_FREE (prev); prev = trav; } diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index 63f4bfeaa..e7e5fce53 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -65,8 +65,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_statfs_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -165,8 +164,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lookup_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -223,8 +221,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lk_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -274,8 +271,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -325,8 +321,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -375,8 +370,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -425,8 +419,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -462,8 +455,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -515,8 +507,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rmdir_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -563,8 +554,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mkdir_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -611,8 +601,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mknod_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -647,8 +636,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -695,8 +683,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readdir_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); readdir_rsp_cleanup (&rsp); @@ -740,8 +727,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_opendir_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -776,8 +762,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -812,8 +797,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -854,11 +838,9 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_getxattr_rsp); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -900,11 +882,9 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fgetxattr_rsp); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -943,8 +923,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -984,8 +963,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1070,8 +1048,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rename_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1125,8 +1102,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_unlink_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1173,8 +1149,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_symlink_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1225,8 +1200,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_link_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1264,8 +1238,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_truncate_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1302,8 +1275,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fstat_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1341,8 +1313,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_ftruncate_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1376,8 +1347,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1415,8 +1385,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsync_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1454,8 +1423,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_write_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1505,8 +1473,7 @@ out: server_submit_reply (frame, req, &rsp, vector, count, iobref, (xdrproc_t)xdr_gfs3_read_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1547,8 +1514,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rchecksum_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1591,8 +1557,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_open_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1677,8 +1642,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_create_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1720,8 +1684,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readlink_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1759,8 +1722,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_stat_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1800,8 +1762,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_setattr_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1840,8 +1801,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsetattr_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1881,11 +1841,9 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_xattrop_rsp); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1925,11 +1883,9 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fxattrop_rsp); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + GF_FREE (rsp.dict.dict_val); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1979,8 +1935,7 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readdirp_rsp); - if (rsp.xdata.xdata_val) - GF_FREE (rsp.xdata.xdata_val); + GF_FREE (rsp.xdata.xdata_val); readdirp_rsp_cleanup (&rsp); @@ -2985,8 +2940,7 @@ server3_3_stat (rpcsvc_request_t *req) resolve_and_resume (frame, server_stat_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3046,8 +3000,7 @@ out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); return ret; } @@ -3101,8 +3054,7 @@ server3_3_fsetattr (rpcsvc_request_t *req) resolve_and_resume (frame, server_fsetattr_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3158,8 +3110,7 @@ server3_3_readlink (rpcsvc_request_t *req) resolve_and_resume (frame, server_readlink_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3227,8 +3178,7 @@ server3_3_create (rpcsvc_request_t *req) out: /* memory allocated by libc, don't use GF_FREE */ - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3286,8 +3236,7 @@ out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); return ret; } @@ -3343,8 +3292,7 @@ server3_3_readv (rpcsvc_request_t *req) resolve_and_resume (frame, server_readv_resume); out: /* memory allocated by libc, don't use GF_FREE */ - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3425,8 +3373,7 @@ server3_3_writev (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_writev_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3483,8 +3430,7 @@ server3_3_writev_vecsizer (int state, ssize_t *readsize, char *base_addr, else nextstate = SERVER3_3_VECWRITE_READING_OPAQUE; - if (write_req.xdata.xdata_val) - free (write_req.xdata.xdata_val); + free (write_req.xdata.xdata_val); break; @@ -3606,8 +3552,7 @@ server3_3_fsync (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fsync_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3662,8 +3607,7 @@ server3_3_flush (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_flush_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3719,8 +3663,7 @@ server3_3_ftruncate (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_ftruncate_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3774,8 +3717,7 @@ server3_3_fstat (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fstat_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3829,8 +3771,7 @@ server3_3_truncate (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_truncate_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3889,8 +3830,7 @@ server3_3_unlink (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_unlink_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -3959,8 +3899,7 @@ server3_3_setxattr (rpcsvc_request_t *req) return ret; out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4030,8 +3969,7 @@ server3_3_fsetxattr (rpcsvc_request_t *req) return ret; out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4102,8 +4040,7 @@ server3_3_fxattrop (rpcsvc_request_t *req) return ret; out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4173,8 +4110,7 @@ server3_3_xattrop (rpcsvc_request_t *req) return ret; out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4238,8 +4174,7 @@ server3_3_getxattr (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_getxattr_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4297,8 +4232,7 @@ server3_3_fgetxattr (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fgetxattr_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4355,8 +4289,7 @@ server3_3_removexattr (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_removexattr_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4413,8 +4346,7 @@ server3_3_fremovexattr (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fremovexattr_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4469,8 +4401,7 @@ server3_3_opendir (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_opendir_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4542,8 +4473,7 @@ out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (args.dict.dict_val) - free (args.dict.dict_val); + free (args.dict.dict_val); return ret; } @@ -4606,8 +4536,7 @@ server3_3_readdir (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_readdir_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4661,8 +4590,7 @@ server3_3_fsyncdir (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fsyncdir_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4728,8 +4656,7 @@ out: req->rpc_err = GARBAGE_ARGS; /* memory allocated by libc, don't use GF_FREE */ - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); return ret; @@ -4791,8 +4718,7 @@ out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); return ret; } @@ -4847,8 +4773,7 @@ server3_3_rmdir (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_rmdir_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -4935,11 +4860,9 @@ server3_3_inodelk (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_inodelk_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); - if (args.flock.lk_owner.lk_owner_val) - free (args.flock.lk_owner.lk_owner_val); + free (args.flock.lk_owner.lk_owner_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5023,11 +4946,9 @@ server3_3_finodelk (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_finodelk_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); - if (args.flock.lk_owner.lk_owner_val) - free (args.flock.lk_owner.lk_owner_val); + free (args.flock.lk_owner.lk_owner_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5090,8 +5011,7 @@ server3_3_entrylk (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_entrylk_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5153,8 +5073,7 @@ server3_3_fentrylk (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fentrylk_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5207,8 +5126,7 @@ server3_3_access (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_access_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5273,8 +5191,7 @@ out: req->rpc_err = GARBAGE_ARGS; /* memory allocated by libc, don't use GF_FREE */ - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); return ret; } @@ -5331,8 +5248,7 @@ server3_3_link (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_link_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5393,8 +5309,7 @@ server3_3_rename (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_rename_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5495,11 +5410,9 @@ server3_3_lk (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_lk_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); - if (args.flock.lk_owner.lk_owner_val) - free (args.flock.lk_owner.lk_owner_val); + free (args.flock.lk_owner.lk_owner_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; @@ -5554,8 +5467,7 @@ server3_3_rchecksum (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_rchecksum_resume); out: - if (args.xdata.xdata_val) - free (args.xdata.xdata_val); + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index b7612e012..74dbc17e6 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -619,8 +619,7 @@ validate_auth_options (xlator_t *this, dict_t *dict) } out: - if (tmp_addr_list) - GF_FREE (tmp_addr_list); + GF_FREE (tmp_addr_list); return error; } @@ -865,8 +864,7 @@ reconfigure (xlator_t *this, dict_t *options) /*ret = dict_get_str (options, "statedump-path", &statedump_path); if (!ret) { gf_path_strip_trailing_slashes (statedump_path); - if (this->ctx->statedump_path) - GF_FREE (this->ctx->statedump_path); + GF_FREE (this->ctx->statedump_path); this->ctx->statedump_path = gf_strdup (statedump_path); }*/ GF_OPTION_RECONF ("statedump-path", statedump_path, @@ -878,8 +876,7 @@ reconfigure (xlator_t *this, dict_t *options) goto out; } gf_path_strip_trailing_slashes (statedump_path); - if (this->ctx->statedump_path) - GF_FREE (this->ctx->statedump_path); + GF_FREE (this->ctx->statedump_path); this->ctx->statedump_path = gf_strdup (statedump_path); if (!conf->auth_modules) diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 46bb6ea59..c649482f4 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -187,8 +187,7 @@ _posix_xattr_get_set (dict_t *xattr_req, err: if (_fd != -1) close (_fd); - if (databuf) - GF_FREE (databuf); + GF_FREE (databuf); } } else if (!strcmp (key, GLUSTERFS_OPEN_FD_COUNT)) { loc = filler->loc; @@ -639,8 +638,7 @@ posix_get_file_contents (xlator_t *this, uuid_t pargfid, out: if (op_ret < 0) { - if (*contents) - GF_FREE (*contents); + GF_FREE (*contents); if (file_fd != -1) close (file_fd); } diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index e667215f2..23ea046a9 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -2070,8 +2070,7 @@ __posix_writev (int fd, struct iovec *vector, int count, off_t startoff, } err: - if (alloc_buf) - GF_FREE (alloc_buf); + GF_FREE (alloc_buf); return op_ret; } @@ -3280,11 +3279,9 @@ do_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, } out: - if (array) - GF_FREE (array); + GF_FREE (array); - if (path) - GF_FREE (path); + GF_FREE (path); STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, xattr, NULL); return 0; @@ -3872,8 +3869,7 @@ out: STACK_UNWIND_STRICT (rchecksum, frame, op_ret, op_errno, weak_checksum, strong_checksum, NULL); - if (buf) - GF_FREE (buf); + GF_FREE (buf); return 0; } diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c index f2fe7d9c4..0962f6404 100644 --- a/xlators/system/posix-acl/src/posix-acl.c +++ b/xlators/system/posix-acl/src/posix-acl.c @@ -2072,11 +2072,9 @@ fini (xlator_t *this) LOCK_DESTROY (&conf->acl_lock); - if (minacl) - GF_FREE (minacl); + GF_FREE (minacl); - if (conf) - GF_FREE (conf); + GF_FREE (conf); return 0; } |