summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-11-02 01:39:00 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-11-02 01:58:58 -0700
commit0fe40b1f74a4b070ce2e8928adab52524b86e273 (patch)
tree679db1e8eee88bc9830f0bdce960436e5cc6d0b1 /cli
parent33ce70b6fb7f3e268bcb166477c1e79e19b48a11 (diff)
Fix crash while freeing tmp_list in cli_cmd_volume_create_parse
Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2047 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2047
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index e7ebd2a3696..aa108f3f2d9 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -57,6 +57,7 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
char *freeptr = NULL;
char *trans_type = NULL;
int32_t index = 0;
+ char *free_list_ptr = NULL;
GF_ASSERT (words);
GF_ASSERT (options);
@@ -220,6 +221,7 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
}
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);
@@ -227,6 +229,8 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
ret = -1;
cli_out ("Found duplicate"
" exports %s",words[brick_index]);
+ if (free_list_ptr)
+ free (free_list_ptr);
goto out;
}
tmp_list = tmpptr;
@@ -245,6 +249,8 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
if (ret)
goto out;
*/
+ if (free_list_ptr)
+ free (free_list_ptr);
}
/* If brick-count is not valid when replica or stripe is
@@ -285,9 +291,6 @@ out:
if (trans_type)
GF_FREE (trans_type);
- if (tmp_list)
- free (tmp_list);
-
return ret;
}