summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-global.c2
-rw-r--r--cli/src/cli-cmd-peer.c2
-rw-r--r--cli/src/cli-cmd-snapshot.c2
-rw-r--r--cli/src/cli-cmd-system.c2
-rw-r--r--cli/src/cli-cmd-volume.c14
-rw-r--r--cli/src/cli-rpc-ops.c4
-rw-r--r--cli/src/cli-xml-output.c2
7 files changed, 15 insertions, 13 deletions
diff --git a/cli/src/cli-cmd-global.c b/cli/src/cli-cmd-global.c
index fb2ecb1d3de..3c8ae227ca7 100644
--- a/cli/src/cli-cmd-global.c
+++ b/cli/src/cli-cmd-global.c
@@ -57,7 +57,7 @@ cli_cmd_global_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
struct cli_cmd *global_cmd = NULL;
int count = 0;
- cmd = GF_CALLOC (1, sizeof (global_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (global_cmds), cli_mt_cli_cmd);
memcpy (cmd, global_cmds, sizeof (global_cmds));
count = (sizeof (global_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
index 7df60bcb2be..a50ea7c66b5 100644
--- a/cli/src/cli-cmd-peer.c
+++ b/cli/src/cli-cmd-peer.c
@@ -284,7 +284,7 @@ cli_cmd_peer_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
cli_out ("\ngluster peer commands");
cli_out ("======================\n");
- cmd = GF_CALLOC (1, sizeof (cli_probe_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (cli_probe_cmds), cli_mt_cli_cmd);
memcpy (cmd, cli_probe_cmds, sizeof (cli_probe_cmds));
count = (sizeof (cli_probe_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
diff --git a/cli/src/cli-cmd-snapshot.c b/cli/src/cli-cmd-snapshot.c
index 06e00c96b7e..64cbd42ce5a 100644
--- a/cli/src/cli-cmd-snapshot.c
+++ b/cli/src/cli-cmd-snapshot.c
@@ -131,7 +131,7 @@ cli_cmd_snapshot_help_cbk (struct cli_state *state,
struct cli_cmd *snap_cmd = NULL;
int count = 0;
- cmd = GF_CALLOC (1, sizeof (snapshot_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (snapshot_cmds), cli_mt_cli_cmd);
memcpy (cmd, snapshot_cmds, sizeof (snapshot_cmds));
count = (sizeof (snapshot_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
diff --git a/cli/src/cli-cmd-system.c b/cli/src/cli-cmd-system.c
index c41594bfa59..995e1b1ad5c 100644
--- a/cli/src/cli-cmd-system.c
+++ b/cli/src/cli-cmd-system.c
@@ -592,7 +592,7 @@ cli_cmd_system_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
struct cli_cmd *system_cmd = NULL;
int count = 0;
- cmd = GF_CALLOC (1, sizeof (cli_system_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (cli_system_cmds), cli_mt_cli_cmd);
memcpy (cmd, cli_system_cmds, sizeof (cli_system_cmds));
count = (sizeof (cli_system_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index b9fd56362cf..d8b9e25f198 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -897,6 +897,7 @@ cli_event_remove_brick_str (dict_t *options, char **event_str,
int32_t i = 1;
int32_t count = 0;
int32_t eventstrlen = 1;
+ int bricklen = 0;
char *tmp_ptr = NULL;
if (!options || !event_str || !event)
@@ -971,8 +972,9 @@ cli_event_remove_brick_str (dict_t *options, char **event_str,
break;
}
snprintf (tmp_ptr, eventstrlen, "%s ", brick);
- eventstrlen -= (strlen (brick) + 1);
- tmp_ptr += (strlen (brick) + 1);
+ bricklen = strlen (brick);
+ eventstrlen -= (bricklen + 1);
+ tmp_ptr += (bricklen + 1);
i++;
}
@@ -3504,7 +3506,7 @@ cli_cmd_quota_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
struct cli_cmd *quota_cmd = NULL;
int count = 0;
- cmd = GF_CALLOC (1, sizeof (quota_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (quota_cmds), cli_mt_cli_cmd);
memcpy (cmd, quota_cmds, sizeof (quota_cmds));
count = (sizeof (quota_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
@@ -3531,7 +3533,7 @@ cli_cmd_bitrot_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
struct cli_cmd *bitrot_cmd = NULL;
int count = 0;
- cmd = GF_CALLOC (1, sizeof (bitrot_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (bitrot_cmds), cli_mt_cli_cmd);
memcpy (cmd, bitrot_cmds, sizeof (bitrot_cmds));
count = (sizeof (bitrot_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
@@ -3558,7 +3560,7 @@ cli_cmd_tier_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
struct cli_cmd *tier_cmd = NULL;
int count = 0;
- cmd = GF_CALLOC (1, sizeof (tier_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (tier_cmds), cli_mt_cli_cmd);
memcpy (cmd, tier_cmds, sizeof (tier_cmds));
count = (sizeof (tier_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
@@ -3584,7 +3586,7 @@ cli_cmd_volume_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
struct cli_cmd *vol_cmd = NULL;
int count = 0;
- cmd = GF_CALLOC (1, sizeof (volume_cmds), cli_mt_cli_cmd);
+ cmd = GF_MALLOC (sizeof (volume_cmds), cli_mt_cli_cmd);
memcpy (cmd, volume_cmds, sizeof (volume_cmds));
count = (sizeof (volume_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 1e95836e4af..40bd64b983c 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -5848,7 +5848,7 @@ gf_cli_gsync_status_output (dict_t *dict, gf_boolean_t is_detail)
/* gsync_count = number of nodes reporting output.
each sts_val object will store output of each
node */
- sts_vals = GF_CALLOC (gsync_count, sizeof (gf_gsync_status_t *),
+ sts_vals = GF_MALLOC (gsync_count * sizeof (gf_gsync_status_t *),
gf_common_mt_char);
if (!sts_vals) {
ret = -1;
@@ -8326,7 +8326,7 @@ xml_end:
goto out;
}
- status.brick = GF_CALLOC (1, PATH_MAX + 256, gf_common_mt_strdup);
+ status.brick = GF_MALLOC (PATH_MAX + 256, gf_common_mt_strdup);
if (!status.brick) {
errno = ENOMEM;
ret = -1;
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index dcb1715e625..fd42192162b 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -4138,7 +4138,7 @@ cli_xml_output_vol_gsync_status (dict_t *dict,
if (ret)
goto out;
- status_values = GF_CALLOC (count, sizeof (gf_gsync_status_t *),
+ status_values = GF_MALLOC (count * sizeof (gf_gsync_status_t *),
gf_common_mt_char);
if (!status_values) {
ret = -1;