summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index aa108f3f2d9..3780abefe5f 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -447,6 +447,7 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount,
char *host_name = NULL;
char *tmp = NULL;
char *freeptr = NULL;
+ char *free_list_ptr = NULL;
GF_ASSERT (words);
GF_ASSERT (options);
@@ -547,6 +548,7 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount,
GF_FREE (freeptr);
tmp_list = strdup(brick_list+1);
+ free_list_ptr = tmp_list;
j = 0;
while(( brick_count != 0) && (j < brick_count)) {
strtok_r (tmp_list, " ", &tmpptr);
@@ -554,6 +556,8 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount,
ret = -1;
cli_out ("Found duplicate"
" exports %s",words[brick_index]);
+ if (free_list_ptr)
+ free (free_list_ptr);
goto out;
}
tmp_list = tmpptr;
@@ -573,6 +577,8 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount,
if (ret)
goto out;
*/
+ if (free_list_ptr)
+ free (free_list_ptr);
}
ret = dict_set_str (dict, "bricks", brick_list);
if (ret)
@@ -591,8 +597,6 @@ out:
if (dict)
dict_destroy (dict);
}
- if (tmp_list)
- free (tmp_list);
return ret;
}