summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c18
-rw-r--r--cli/src/cli-cmd-volume.c6
-rw-r--r--cli/src/cli-cmd.c3
-rw-r--r--cli/src/cli-rl.c3
-rw-r--r--cli/src/cli-rpc-ops.c121
-rw-r--r--cli/src/cli-xml-output.c3
-rw-r--r--cli/src/cli.c3
7 files changed, 51 insertions, 106 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 8c16588ae9c..18b628ae18b 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 19b821bd85d..9be933a7638 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 f2b434ac7a4..8c384e23eee 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 b4a5de01361..a94cfcde51b 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 a046d12a35e..3d551a163bb 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 510ad01033e..4f19400a574 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 16e434f0f8b..0d9582dcb8c 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);