diff options
114 files changed, 727 insertions, 1483 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 8c16588ae..18b628ae1 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -148,8 +148,7 @@ cli_cmd_bricks_parse (const char **words, int wordcount, int brick_index, if (!*bricks) ret = -1; out: - if (free_list_ptr) - GF_FREE (free_list_ptr); + GF_FREE (free_list_ptr); return ret; } @@ -386,8 +385,7 @@ out: dict_destroy (dict); } - if (trans_type) - GF_FREE (trans_type); + GF_FREE (trans_type); return ret; } @@ -1022,10 +1020,8 @@ out: dict_destroy (dict); } - if (tmp_brick) - GF_FREE (tmp_brick); - if (tmp_brick1) - GF_FREE (tmp_brick1); + GF_FREE (tmp_brick); + GF_FREE (tmp_brick1); return ret; } @@ -1613,13 +1609,11 @@ out: if (ret) { if (dict) dict_destroy (dict); - if (append_str) - GF_FREE (append_str); + GF_FREE (append_str); } else *options = dict; - if (subop) - GF_FREE (subop); + GF_FREE (subop); return ret; } diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 19b821bd8..9be933a76 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -317,13 +317,11 @@ found_bad_brick_order: out: ai_list_tmp2 = NULL; i = 0; - if (brick_list_dup) - GF_FREE (brick_list_dup); + GF_FREE (brick_list_dup); list_for_each_entry (ai_list_tmp1, &ai_list->list, list) { if (ai_list_tmp1->info) freeaddrinfo (ai_list_tmp1->info); - if (ai_list_tmp2) - free (ai_list_tmp2); + free (ai_list_tmp2); ai_list_tmp2 = ai_list_tmp1; } free (ai_list_tmp2); diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index f2b434ac7..8c384e23e 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -211,8 +211,7 @@ cli_cmd_process_line (struct cli_state *state, const char *text) ret = cli_cmd_process (state, count, tokens); out: - if (copy) - free (copy); + free (copy); if (tokens) cli_cmd_tokens_destroy (tokens); diff --git a/cli/src/cli-rl.c b/cli/src/cli-rl.c index b4a5de013..a94cfcde5 100644 --- a/cli/src/cli-rl.c +++ b/cli/src/cli-rl.c @@ -226,8 +226,7 @@ cli_rl_tokenize (const char *text) } out: - if (copy) - free (copy); + free (copy); if (i < count) { cli_cmd_tokens_destroy (tokens); diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index a046d12a3..3d551a163 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -743,11 +743,9 @@ out: if (dict) dict_destroy (dict); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); - if (rsp.op_errstr) - free (rsp.op_errstr); + free (rsp.op_errstr); gf_log ("cli", GF_LOG_INFO, "Returning: %d", ret); return ret; @@ -808,10 +806,8 @@ out: dict_unref (dict); if (local) cli_local_wipe (local); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); - if (rsp.op_errstr) - free (rsp.op_errstr); + free (rsp.dict.dict_val); + free (rsp.op_errstr); return ret; } @@ -872,8 +868,7 @@ gf_cli_delete_volume_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); cli_local_wipe (local); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); if (dict) dict_unref (dict); @@ -943,10 +938,8 @@ out: cli_cmd_broadcast_response (ret); if (local) cli_local_wipe (local); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); - if (rsp.op_errstr) - free (rsp.op_errstr); + free (rsp.dict.dict_val); + free (rsp.op_errstr); if (dict) dict_unref (dict); return ret; @@ -1012,10 +1005,8 @@ gf_cli_stop_volume_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); - if (rsp.op_errstr) - free (rsp.op_errstr); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.op_errstr); + free (rsp.dict.dict_val); if (local) cli_local_wipe (local); @@ -1241,10 +1232,8 @@ done: ret = rsp.op_ret; out: - if (rsp.op_errstr) - free (rsp.op_errstr); //malloced by xdr - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); //malloced by xdr + free (rsp.op_errstr); //malloced by xdr + free (rsp.dict.dict_val); //malloced by xdr if (dict) dict_unref (dict); if (local_dict) @@ -1458,10 +1447,8 @@ gf_cli_add_brick_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); - if (rsp.op_errstr) - free (rsp.op_errstr); + free (rsp.dict.dict_val); + free (rsp.op_errstr); return ret; } @@ -1622,8 +1609,7 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov, cli_out ("%s", msg); */ out: - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); //malloced by xdr + free (rsp.dict.dict_val); //malloced by xdr if (dict) dict_unref (dict); cli_cmd_broadcast_response (ret); @@ -1712,10 +1698,8 @@ out: } cli_cmd_broadcast_response (ret); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); - if (rsp.op_errstr) - free (rsp.op_errstr); + free (rsp.dict.dict_val); + free (rsp.op_errstr); return ret; } @@ -1881,8 +1865,7 @@ out: } cli_cmd_broadcast_response (ret); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); if (rsp_dict) dict_unref (rsp_dict); @@ -1935,8 +1918,7 @@ gf_cli_log_rotate_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); return ret; } @@ -2222,8 +2204,7 @@ xml_output: out: cli_cmd_broadcast_response (ret); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); return ret; } @@ -2508,8 +2489,7 @@ out: if (dict) dict_unref (dict); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -2560,9 +2540,7 @@ out: if (dict) dict_unref (dict); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + GF_FREE (req.dict.dict_val); return ret; } @@ -2610,8 +2588,7 @@ gf_cli_delete_volume (call_frame_t *frame, xlator_t *this, out: if (dict) dict_unref (dict); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -2953,9 +2930,7 @@ gf_cli_add_brick (call_frame_t *frame, xlator_t *this, out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + GF_FREE (req.dict.dict_val); return ret; } @@ -3062,12 +3037,9 @@ gf_cli_remove_brick (call_frame_t *frame, xlator_t *this, out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + GF_FREE (req.dict.dict_val); - if (status_req.dict.dict_val) - GF_FREE (status_req.dict.dict_val); + GF_FREE (status_req.dict.dict_val); if (req_dict) dict_unref (req_dict); @@ -3155,9 +3127,7 @@ gf_cli_replace_brick (call_frame_t *frame, xlator_t *this, out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + GF_FREE (req.dict.dict_val); return ret; } @@ -3195,8 +3165,7 @@ gf_cli_log_rotate (call_frame_t *frame, xlator_t *this, out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } @@ -3229,8 +3198,7 @@ gf_cli_sync_volume (call_frame_t *frame, xlator_t *this, out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } @@ -3634,8 +3602,7 @@ out: cli_cmd_broadcast_response (ret); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); return ret; } @@ -3670,8 +3637,7 @@ gf_cli_gsync_set (call_frame_t *frame, xlator_t *this, (xdrproc_t) xdr_gf_cli_req); out: - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } @@ -4005,8 +3971,7 @@ gf_cli_profile_volume_cbk (struct rpc_req *req, struct iovec *iov, out: if (dict) dict_unref (dict); - if (rsp.op_errstr) - free (rsp.op_errstr); + free (rsp.op_errstr); cli_cmd_broadcast_response (ret); return ret; } @@ -4045,8 +4010,7 @@ gf_cli_profile_volume (call_frame_t *frame, xlator_t *this, void *data) out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } @@ -4282,8 +4246,7 @@ out: if (dict) dict_unref (dict); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); + free (rsp.dict.dict_val); return ret; } @@ -4319,8 +4282,7 @@ gf_cli_top_volume (call_frame_t *frame, xlator_t *this, void *data) out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } @@ -5577,8 +5539,7 @@ cont: ret = rsp.op_ret; out: - if (status.brick) - GF_FREE (status.brick); + GF_FREE (status.brick); cli_cmd_broadcast_response (ret); return ret; @@ -6002,8 +5963,7 @@ out: cli_cmd_broadcast_response (ret); if (local) cli_local_wipe (local); - if (rsp.op_errstr) - free (rsp.op_errstr); + free (rsp.op_errstr); if (dict) dict_unref (dict); return ret; @@ -6048,8 +6008,7 @@ gf_cli_heal_volume (call_frame_t *frame, xlator_t *this, out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } @@ -6130,8 +6089,7 @@ out: dict_destroy (options); gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } @@ -6331,8 +6289,7 @@ out: dict_destroy (options); gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); return ret; } diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 510ad0103..4f19400a5 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2493,8 +2493,7 @@ cont: ret = cli_end_xml_output (writer, buf); out: - if (size_str) - GF_FREE (size_str); + GF_FREE (size_str); gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; } diff --git a/cli/src/cli.c b/cli/src/cli.c index 16e434f0f..0d9582dcb 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -565,8 +565,7 @@ void cli_local_wipe (cli_local_t *local) { if (local) { - if (local->get_vol.volname) - GF_FREE (local->get_vol.volname); + GF_FREE (local->get_vol.volname); if (local->dict) dict_unref (local->dict); GF_FREE (local); diff --git a/contrib/fuse-util/fusermount.c b/contrib/fuse-util/fusermount.c index 20a15bed2..0ff8d9039 100644 --- a/contrib/fuse-util/fusermount.c +++ b/contrib/fuse-util/fusermount.c @@ -650,8 +650,7 @@ static int get_string_opt(const char *s, unsigned len, const char *opt, unsigned opt_len = strlen(opt); char *d; - if (*val) - free(*val); + free(*val); *val = (char *) malloc(len - opt_len + 1); if (!*val) { fprintf(stderr, "%s: failed to allocate memory\n", progname); diff --git a/doc/legacy/coding-standard.tex b/doc/legacy/coding-standard.tex index abaedb69c..30d412a91 100644 --- a/doc/legacy/coding-standard.tex +++ b/doc/legacy/coding-standard.tex @@ -370,8 +370,7 @@ sample_fop (call_frame_t *frame, xlator_t *this, ...) } if (pfd) { - if (pfd->path) - FREE (pfd->path); + FREE (pfd->path); FREE (pfd); pfd = NULL; } diff --git a/extras/stripe-merge.c b/extras/stripe-merge.c index 32768badd..74bd47e30 100644 --- a/extras/stripe-merge.c +++ b/extras/stripe-merge.c @@ -305,14 +305,10 @@ file_stripe_info *validate_and_open_files(char *paths[], int count) return finfo; err: - if (stripe_count_attr) - free(stripe_count_attr); - if (stripe_size_attr) - free(stripe_size_attr); - if (stripe_index_attr) - free(stripe_index_attr); - if (stripe_coalesce_attr) - free(stripe_coalesce_attr); + free(stripe_count_attr); + free(stripe_size_attr); + free(stripe_index_attr); + free(stripe_coalesce_attr); if (finfo) { close_files(finfo); diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 9262451c6..f37129878 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -194,8 +194,7 @@ glusterfs_terminate_response_send (rpcsvc_request_t *req, int op_ret) ret = glusterfs_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gd1_mgmt_brick_op_rsp); - if (rsp.output.output_val) - GF_FREE (rsp.output.output_val); + GF_FREE (rsp.output.output_val); if (dict) dict_unref (dict); return ret; @@ -289,10 +288,8 @@ out: ret = glusterfs_translator_info_response_send (priv->req, ret, msg, output); - if (priv->xlator_req.name) - free (priv->xlator_req.name); - if (priv->xlator_req.input.input_val) - free (priv->xlator_req.input.input_val); + free (priv->xlator_req.name); + free (priv->xlator_req.input.input_val); if (dict) dict_unref (dict); if (output) @@ -499,8 +496,7 @@ out: close (fd); if (input_fd >= 0) close (input_fd); - if (buf) - GF_FREE (buf); + GF_FREE (buf); unlink (export_path); (void)glusterfs_handle_translator_info_get_cont (priv); @@ -625,8 +621,7 @@ out: close (input_fd); if (output_fd >= 0) close (output_fd); - if (buf) - GF_FREE (buf); + GF_FREE (buf); unlink (export_path); (void)glusterfs_handle_translator_info_get_cont (priv); @@ -716,8 +711,7 @@ out: dict_unref (input); if (output) dict_unref (output); - if (xlator_req.name) - free (xlator_req.name); //malloced by xdr + free (xlator_req.name); //malloced by xdr return 0; } @@ -790,12 +784,10 @@ glusterfs_handle_defrag (rpcsvc_request_t *req) out: if (dict) dict_unref (dict); - if (xlator_req.input.input_val) - free (xlator_req.input.input_val); // malloced by xdr + free (xlator_req.input.input_val); // malloced by xdr if (output) dict_unref (output); - if (xlator_req.name) - free (xlator_req.name); //malloced by xdr + free (xlator_req.name); //malloced by xdr return ret; @@ -922,14 +914,10 @@ out: dict_unref (dict); if (output) dict_unref (output); - if (brick_req.input.input_val) - free (brick_req.input.input_val); - if (xname) - GF_FREE (xname); - if (msg) - GF_FREE (msg); - if (rsp.output.output_val) - GF_FREE (rsp.output.output_val); + free (brick_req.input.input_val); + GF_FREE (xname); + GF_FREE (msg); + GF_FREE (rsp.output.output_val); return ret; } @@ -1104,16 +1092,11 @@ glusterfs_handle_node_status (rpcsvc_request_t *req) out: if (dict) dict_unref (dict); - if (node_req.input.input_val) - free (node_req.input.input_val); - if (msg) - GF_FREE (msg); - if (rsp.output.output_val) - GF_FREE (rsp.output.output_val); - if (node_name) - GF_FREE (node_name); - if (subvol_name) - GF_FREE (subvol_name); + free (node_req.input.input_val); + GF_FREE (msg); + GF_FREE (rsp.output.output_val); + GF_FREE (node_name); + GF_FREE (subvol_name); gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1200,14 +1183,12 @@ glusterfs_handle_nfs_profile (rpcsvc_request_t *req) (xdrproc_t)xdr_gd1_mgmt_brick_op_rsp); out: - if (nfs_req.input.input_val) - free (nfs_req.input.input_val); + free (nfs_req.input.input_val); if (dict) dict_unref (dict); if (output) dict_unref (output); - if (rsp.output.output_val) - GF_FREE (rsp.output.output_val); + GF_FREE (rsp.output.output_val); gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1627,8 +1608,7 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, out: STACK_DESTROY (frame->root); - if (rsp.spec) - free (rsp.spec); + free (rsp.spec); if (ret && ctx && !ctx->active) { /* Do it only for the first time */ @@ -1699,8 +1679,7 @@ mgmt_event_notify_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } out: - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); //malloced by xdr + free (rsp.dict.dict_val); //malloced by xdr return ret; } @@ -1739,8 +1718,7 @@ glusterfs_rebalance_event_notify_cbk (struct rpc_req *req, struct iovec *iov, goto out; } out: - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); //malloced by xdr + free (rsp.dict.dict_val); //malloced by xdr return ret; } @@ -1775,8 +1753,7 @@ glusterfs_rebalance_event_notify (dict_t *dict) glusterfs_rebalance_event_notify_cbk, (xdrproc_t)xdr_gf_event_notify_req); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + GF_FREE (req.dict.dict_val); STACK_DESTROY (frame->root); return ret; diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 76f019481..93e840606 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -531,12 +531,9 @@ gf_remember_xlator_option (struct list_head *options, char *arg) out: if (ret == -1) { if (option) { - if (option->volume) - GF_FREE (option->volume); - if (option->key) - GF_FREE (option->key); - if (option->value) - GF_FREE (option->value); + GF_FREE (option->volume); + GF_FREE (option->key); + GF_FREE (option->value); GF_FREE (option); } @@ -615,8 +612,7 @@ parse_opts (int key, char *arg, struct argp_state *state) break; case ARGP_VOLUME_FILE_KEY: - if (cmd_args->volfile) - GF_FREE (cmd_args->volfile); + GF_FREE (cmd_args->volfile); if (arg[0] != '/') { pwd = getcwd (NULL, PATH_MAX); diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 85a1aaa7b..0ca5bf7f1 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -3712,8 +3712,7 @@ call_stub_destroy_wind (call_stub_t *stub) case GF_FOP_GETXATTR: { - if (stub->args.getxattr.name) - GF_FREE ((char *)stub->args.getxattr.name); + GF_FREE ((char *)stub->args.getxattr.name); loc_wipe (&stub->args.getxattr.loc); break; } @@ -3728,8 +3727,7 @@ call_stub_destroy_wind (call_stub_t *stub) case GF_FOP_FGETXATTR: { - if (stub->args.fgetxattr.name) - GF_FREE ((char *)stub->args.fgetxattr.name); + GF_FREE ((char *)stub->args.fgetxattr.name); fd_unref (stub->args.fgetxattr.fd); break; } @@ -3792,16 +3790,14 @@ call_stub_destroy_wind (call_stub_t *stub) case GF_FOP_INODELK: { - if (stub->args.inodelk.volume) - GF_FREE ((char *)stub->args.inodelk.volume); + GF_FREE ((char *)stub->args.inodelk.volume); loc_wipe (&stub->args.inodelk.loc); break; } case GF_FOP_FINODELK: { - if (stub->args.finodelk.volume) - GF_FREE ((char *)stub->args.finodelk.volume); + GF_FREE ((char *)stub->args.finodelk.volume); if (stub->args.finodelk.fd) fd_unref (stub->args.finodelk.fd); @@ -3809,21 +3805,17 @@ call_stub_destroy_wind (call_stub_t *stub) } case GF_FOP_ENTRYLK: { - if (stub->args.entrylk.volume) - GF_FREE ((char *)stub->args.entrylk.volume); + GF_FREE ((char *)stub->args.entrylk.volume); - if (stub->args.entrylk.name) - GF_FREE ((char *)stub->args.entrylk.name); + GF_FREE ((char *)stub->args.entrylk.name); loc_wipe (&stub->args.entrylk.loc); break; } case GF_FOP_FENTRYLK: { - if (stub->args.fentrylk.volume) - GF_FREE ((char *)stub->args.fentrylk.volume); + GF_FREE ((char *)stub->args.fentrylk.volume); - if (stub->args.fentrylk.name) - GF_FREE ((char *)stub->args.fentrylk.name); + GF_FREE ((char *)stub->args.fentrylk.name); if (stub->args.fentrylk.fd) fd_unref (stub->args.fentrylk.fd); @@ -3922,8 +3914,7 @@ call_stub_destroy_unwind (call_stub_t *stub) case GF_FOP_READLINK: { - if (stub->args.readlink_cbk.buf) - GF_FREE ((char *)stub->args.readlink_cbk.buf); + GF_FREE ((char *)stub->args.readlink_cbk.buf); } break; diff --git a/libglusterfs/src/circ-buff.c b/libglusterfs/src/circ-buff.c index 6c7907a09..65bbd5d45 100644 --- a/libglusterfs/src/circ-buff.c +++ b/libglusterfs/src/circ-buff.c @@ -158,8 +158,7 @@ cb_buffer_destroy (buffer_t *buffer) if (buffer) { if (buffer->cb) { for (i = 0; i < buffer->used_len ; i++) { - if (buffer->cb[i]) - GF_FREE (buffer->cb[i]); + GF_FREE (buffer->cb[i]); } GF_FREE (buffer->cb); } diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 671a3e549..d09cafc68 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -602,8 +602,7 @@ gf_strstr (const char *str, const char *delim, const char *match) } out: - if (tmp_str) - free (tmp_str); + free (tmp_str); return ret; @@ -1684,8 +1683,7 @@ valid_host_name (char *address, int length) } out: - if (dup_addr) - GF_FREE (dup_addr); + GF_FREE (dup_addr); return ret; } @@ -1916,8 +1914,7 @@ gf_is_str_int (const char *value) } out: - if (fptr) - GF_FREE (fptr); + GF_FREE (fptr); return flag; } @@ -2126,8 +2123,7 @@ gf_canonicalize_path (char *path) gf_log ("common-utils", GF_LOG_ERROR, "Path manipulation failed"); - if (tmppath) - GF_FREE(tmppath); + GF_FREE(tmppath); return ret; } diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c index 99a0041a5..2f02eeac5 100644 --- a/libglusterfs/src/compat.c +++ b/libglusterfs/src/compat.c @@ -142,8 +142,7 @@ done: *path = export_path; } out: - if (freeptr) - GF_FREE (freeptr); + GF_FREE (freeptr); if (ret && export_path) GF_FREE (export_path); @@ -195,8 +194,7 @@ solaris_xattr_resolve_path (const char *real_path, char **path) *path = gf_strdup (xattr_path); } out: - if (export_path) - GF_FREE (export_path); + GF_FREE (export_path); if (*path) return 0; else @@ -230,8 +228,7 @@ solaris_setxattr(const char *path, const char* key, const char *value, path, errno); ret = -1; } - if (mapped_path) - GF_FREE (mapped_path); + GF_FREE (mapped_path); return ret; } @@ -297,8 +294,7 @@ solaris_listxattr(const char *path, char *list, size_t size) close (attrdirfd); } out: - if (mapped_path) - GF_FREE (mapped_path); + GF_FREE (mapped_path); return len; } @@ -380,8 +376,7 @@ solaris_removexattr(const char *path, const char* key) ret = -1; } - if (mapped_path) - GF_FREE (mapped_path); + GF_FREE (mapped_path); return ret; } @@ -421,8 +416,7 @@ solaris_getxattr(const char *path, errno = ENODATA; ret = -1; } - if (mapped_path) - GF_FREE (mapped_path); + GF_FREE (mapped_path); return ret; } @@ -494,8 +488,7 @@ int solaris_unlink (const char *path) } out: - if (mapped_path) - GF_FREE (mapped_path); + GF_FREE (mapped_path); return unlink (path); } diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index 2e61a3f4e..c290e0d62 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -181,8 +181,7 @@ data_copy (data_t *old) err_out: - if (newdata->data) - FREE (newdata->data); + FREE (newdata->data); mem_put (newdata); return NULL; @@ -436,10 +435,8 @@ dict_destroy (dict_t *this) mem_put (this->members); } - if (this->extra_free) - GF_FREE (this->extra_free); - if (this->extra_stdfree) - free (this->extra_stdfree); + GF_FREE (this->extra_free); + free (this->extra_stdfree); if (!this->is_static) mem_put (this); diff --git a/libglusterfs/src/event.c b/libglusterfs/src/event.c index 8f172fb24..00175bda4 100644 --- a/libglusterfs/src/event.c +++ b/libglusterfs/src/event.c @@ -376,8 +376,7 @@ event_dispatch_poll_resize (struct event_pool *event_pool, } if (event_pool->used > event_pool->evcache_size) { - if (event_pool->evcache) - GF_FREE (event_pool->evcache); + GF_FREE (event_pool->evcache); event_pool->evcache = ufds = NULL; @@ -808,8 +807,7 @@ event_dispatch_epoll (struct event_pool *event_pool) &event_pool->mutex); if (event_pool->used > event_pool->evcache_size) { - if (event_pool->evcache) - GF_FREE (event_pool->evcache); + GF_FREE (event_pool->evcache); event_pool->evcache = events = NULL; diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 3a7a59278..fede42a74 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -1057,9 +1057,7 @@ unlock: } out: - if (fd_ctx != NULL) { - GF_FREE (fd_ctx); - } + GF_FREE (fd_ctx); return; } diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index 11f62a550..703c5271d 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -126,8 +126,7 @@ static pthread_key_t this_xlator_key; void glusterfs_this_destroy (void *ptr) { - if (ptr) - FREE (ptr); + FREE (ptr); } @@ -254,8 +253,7 @@ static char global_uuid_buf[GF_UUID_BUF_SIZE]; void glusterfs_uuid_buf_destroy (void *ptr) { - if (ptr) - FREE (ptr); + FREE (ptr); } int @@ -291,8 +289,7 @@ static char global_lkowner_buf[GF_LKOWNER_BUF_SIZE]; void glusterfs_lkowner_buf_destroy (void *ptr) { - if (ptr) - FREE (ptr); + FREE (ptr); } int diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index a0088c03c..2efcd89cc 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -134,8 +134,7 @@ __dentry_unset (dentry_t *dentry) list_del_init (&dentry->inode_list); - if (dentry->name) - GF_FREE (dentry->name); + GF_FREE (dentry->name); if (dentry->parent) { __inode_unref (dentry->parent); @@ -1205,9 +1204,7 @@ __inode_path (inode_t *inode, const char *name, char **bufp) out: if (__is_root_gfid (inode->gfid) && !name) { ret = 1; - if (buf) { - GF_FREE (buf); - } + GF_FREE (buf); buf = GF_CALLOC (ret + 1, sizeof (char), gf_common_mt_char); if (buf) { strcpy (buf, "/"); @@ -1385,10 +1382,8 @@ inode_table_new (size_t lru_limit, xlator_t *xl) out: if (ret) { if (new) { - if (new->inode_hash) - GF_FREE (new->inode_hash); - if (new->name_hash) - GF_FREE (new->name_hash); + GF_FREE (new->inode_hash); + GF_FREE (new->name_hash); if (new->dentry_pool) mem_pool_destroy (new->dentry_pool); if (new->inode_pool) @@ -1454,8 +1449,7 @@ inode_from_path (inode_table_t *itable, const char *path) if (parent) inode_unref (parent); - if (pathname) - GF_FREE (pathname); + GF_FREE (pathname); out: return inode; @@ -1667,9 +1661,7 @@ unlock: } } - if (inode_ctx != NULL) { - GF_FREE (inode_ctx); - } + GF_FREE (inode_ctx); return; } diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c index f68c6c748..86bf697e8 100644 --- a/libglusterfs/src/iobuf.c +++ b/libglusterfs/src/iobuf.c @@ -562,8 +562,7 @@ iobuf_get_from_stdalloc (struct iobuf_pool *iobuf_pool, size_t page_size) ret = 0; out: if (ret && iobuf) { - if (iobuf->free_ptr) - GF_FREE (iobuf->free_ptr); + GF_FREE (iobuf->free_ptr); GF_FREE (iobuf); iobuf = NULL; } diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 6071269e0..c41d245f1 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -436,14 +436,11 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, pthread_mutex_unlock (&logfile_mutex); out: - if (msg) - GF_FREE (msg); + GF_FREE (msg); - if (str1) - GF_FREE (str1); + GF_FREE (str1); - if (str2) - FREE (str2); + FREE (str2); return ret; } @@ -581,15 +578,11 @@ log: pthread_mutex_unlock (&logfile_mutex); err: - if (msg) { - GF_FREE (msg); - } + GF_FREE (msg); - if (str1) - GF_FREE (str1); + GF_FREE (str1); - if (str2) - FREE (str2); + FREE (str2); out: return (0); @@ -702,15 +695,11 @@ gf_cmd_log (const char *domain, const char *fmt, ...) fflush (cmdlogfile); out: - if (msg) { - GF_FREE (msg); - } + GF_FREE (msg); - if (str1) - GF_FREE (str1); + GF_FREE (str1); - if (str2) - FREE (str2); + FREE (str2); return (0); } diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c index 76e581fdd..dc1199235 100644 --- a/libglusterfs/src/options.c +++ b/libglusterfs/src/options.c @@ -522,8 +522,7 @@ xlator_option_validate_addr_list (xlator_t *xl, const char *key, out: if (op_errstr && ret) *op_errstr = gf_strdup (errstr); - if (dup_val) - GF_FREE (dup_val); + GF_FREE (dup_val); return ret; } @@ -605,8 +604,7 @@ validate_list_elements (const char *string, volume_option_t *opt, substr_sav = NULL; } out: - if (dup_string) - GF_FREE (dup_string); + GF_FREE (dup_string); gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); return ret; } diff --git a/libglusterfs/src/rbthash.c b/libglusterfs/src/rbthash.c index 4f04fed93..cced943a3 100644 --- a/libglusterfs/src/rbthash.c +++ b/libglusterfs/src/rbthash.c @@ -208,8 +208,7 @@ rbthash_deinit_entry (rbthash_table_t *tbl, rbthash_entry_t *entry) if (!entry) return; - if (entry->key) - GF_FREE (entry->key); + GF_FREE (entry->key); if (tbl) { if ((entry->data) && (tbl->dfunc)) diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 4ef7d7aea..491f6ae15 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -133,8 +133,7 @@ synctask_destroy (struct synctask *task) if (!task) return; - if (task->stack) - FREE (task->stack); + FREE (task->stack); if (task->opframe) STACK_DESTROY (task->opframe->root); @@ -243,8 +242,7 @@ synctask_new (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk, return ret; err: if (newtask) { - if (newtask->stack) - FREE (newtask->stack); + FREE (newtask->stack); if (newtask->opframe) STACK_DESTROY (newtask->opframe->root); FREE (newtask); @@ -983,8 +981,7 @@ syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off, if (vector) *vector = args.vector; - else if (args.vector) - GF_FREE (args.vector); + else GF_FREE (args.vector); if (count) *count = args.count; @@ -1367,8 +1364,7 @@ syncop_readlink (xlator_t *subvol, loc_t *loc, char **buffer, size_t size) if (buffer) *buffer = args.buffer; - else if (args.buffer) - GF_FREE (args.buffer); + else GF_FREE (args.buffer); errno = args.op_errno; return args.op_ret; diff --git a/libglusterfs/src/trie.c b/libglusterfs/src/trie.c index b7c597842..f96bbebf6 100644 --- a/libglusterfs/src/trie.c +++ b/libglusterfs/src/trie.c @@ -114,8 +114,7 @@ trienode_free (trienode_t *node) trienode_free (trav); } - if (node->data) - GF_FREE (node->data); + GF_FREE (node->data); GF_FREE (node); } @@ -373,8 +372,7 @@ trie_measure_vec (trie_t *trie, const char *word, struct trienodevec *nodevec) static int trienode_reset (trienode_t *node, void *data) { - if (node->data) - GF_FREE (node->data); + GF_FREE (node->data); return 0; } diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 7c081fa55..2bac24f04 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -168,8 +168,7 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle, ret = 0; out: - if (name) - GF_FREE (name); + GF_FREE (name); gf_log ("xlator", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -272,8 +271,7 @@ xlator_dynload (xlator_t *xl) ret = 0; out: - if (name) - GF_FREE (name); + GF_FREE (name); return ret; } @@ -647,10 +645,8 @@ xlator_destroy (xlator_t *xl) if (!xl) return 0; - if (xl->name) - GF_FREE (xl->name); - if (xl->type) - GF_FREE (xl->type); + GF_FREE (xl->name); + GF_FREE (xl->type); if (xl->dlhandle) dlclose (xl->dlhandle); if (xl->options) diff --git a/rpc/rpc-lib/src/auth-glusterfs.c b/rpc/rpc-lib/src/auth-glusterfs.c index 5f41c8296..c08871466 100644 --- a/rpc/rpc-lib/src/auth-glusterfs.c +++ b/rpc/rpc-lib/src/auth-glusterfs.c @@ -213,10 +213,8 @@ int auth_glusterfs_v2_authenticate (rpcsvc_request_t *req, void *priv) ret = RPCSVC_AUTH_ACCEPT; err: /* TODO: instead use alloca() for these variables */ - if (au.groups.groups_val) - free (au.groups.groups_val); - if (au.lk_owner.lk_owner_val) - free (au.lk_owner.lk_owner_val); + free (au.groups.groups_val); + free (au.lk_owner.lk_owner_val); return ret; } diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index 9a65f09c0..f099fb6b5 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1721,8 +1721,7 @@ rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath) *options = dict; out: if (ret) { - if (fpath) - GF_FREE (fpath); + GF_FREE (fpath); if (dict) dict_unref (dict); } diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 4b6937424..6d06f0fb0 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -322,19 +322,15 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name) return_trans = trans; - if (name) - GF_FREE (name); + GF_FREE (name); - if (vol_opt) - GF_FREE (vol_opt); + GF_FREE (vol_opt); return return_trans; fail: if (trans) { - if (trans->name) { - GF_FREE (trans->name); - } + GF_FREE (trans->name); if (trans->dl_handle) dlclose (trans->dl_handle); @@ -342,11 +338,9 @@ fail: GF_FREE (trans); } - if (name) - GF_FREE (name); + GF_FREE (name); - if (vol_opt) - GF_FREE (vol_opt); + GF_FREE (vol_opt); return NULL; } @@ -433,8 +427,7 @@ rpc_transport_destroy (rpc_transport_t *this) pthread_mutex_destroy (&this->lock); - if (this->name) - GF_FREE (this->name); + GF_FREE (this->name); if (this->dl_handle) dlclose (this->dl_handle); @@ -615,8 +608,7 @@ rpc_transport_inet_options_build (dict_t **options, const char *hostname, *options = dict; out: if (ret) { - if (host) - GF_FREE (host); + GF_FREE (host); if (dict) dict_unref (dict); } diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index ee9e1c725..634123426 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -1514,17 +1514,13 @@ rpcsvc_create_listeners (rpcsvc_t *svc, dict_t *options, char *name) transport_type = NULL; out: - if (str) - GF_FREE (str); + GF_FREE (str); - if (transport_type) - GF_FREE (transport_type); + GF_FREE (transport_type); - if (tmp) - GF_FREE (tmp); + GF_FREE (tmp); - if (transport_name) - GF_FREE (transport_name); + GF_FREE (transport_name); return count; } @@ -1812,8 +1808,7 @@ rpcsvc_transport_unix_options_build (dict_t **options, char *filepath) *options = dict; out: if (ret) { - if (fpath) - GF_FREE (fpath); + GF_FREE (fpath); if (dict) dict_unref (dict); } @@ -1935,8 +1930,7 @@ rpcsvc_transport_peer_check_search (dict_t *options, char *pattern, char *clstr) ret = -1; err: - if (dup_addrstr) - GF_FREE (dup_addrstr); + GF_FREE (dup_addrstr); return ret; } @@ -2399,8 +2393,7 @@ rpcsvc_transport_privport_check (rpcsvc_t *svc, char *volname, " allowed"); err: - if (srchstr) - GF_FREE (srchstr); + GF_FREE (srchstr); return ret; } @@ -2429,8 +2422,7 @@ rpcsvc_volume_allowed (dict_t *options, char *volname) ret = dict_get_str (options, srchstr, &addrstr); out: - if (srchstr) - GF_FREE (srchstr); + GF_FREE (srchstr); return addrstr; } diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 3d4dfe362..facc92358 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -196,9 +196,7 @@ gf_rdma_new_post (gf_rdma_device_t *device, int32_t len, ret = 0; out: if (ret != 0) { - if (post->buf != NULL) { - free (post->buf); - } + free (post->buf); GF_FREE (post); post = NULL; @@ -2931,9 +2929,7 @@ out: *readch = NULL; } - if (write_ary != NULL) { - GF_FREE (write_ary); - } + GF_FREE (write_ary); } return ret; diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 655e806ab..9db09d77e 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -467,9 +467,7 @@ __socket_reset (rpc_transport_t *this) iobuf_unref (priv->incoming.iobuf); } - if (priv->incoming.request_info != NULL) { - GF_FREE (priv->incoming.request_info); - } + GF_FREE (priv->incoming.request_info); memset (&priv->incoming, 0, sizeof (priv->incoming)); @@ -1102,8 +1100,7 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this) well and good, we don't need to worry about */ xdr_gfs3_read_rsp (&xdr, &read_rsp); - if (read_rsp.xdata.xdata_val) - free (read_rsp.xdata.xdata_val); + free (read_rsp.xdata.xdata_val); /* need to round off to proper roof (%4), as XDR packing pads the end of opaque object with '0' */ diff --git a/rpc/xdr/src/xdr-nfs3.c b/rpc/xdr/src/xdr-nfs3.c index 35fca59ff..b6402b07c 100644 --- a/rpc/xdr/src/xdr-nfs3.c +++ b/rpc/xdr/src/xdr-nfs3.c @@ -1848,12 +1848,10 @@ xdr_free_exports_list (struct exportnode *first) while (first) { elist = first->ex_next; - if (first->ex_dir) - GF_FREE (first->ex_dir); + GF_FREE (first->ex_dir); if (first->ex_groups) { - if (first->ex_groups->gr_name) - GF_FREE (first->ex_groups->gr_name); + GF_FREE (first->ex_groups->gr_name); GF_FREE (first->ex_groups); } 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; } |