Replace strdup call to gf_strdup as GF_FREE is being called

Also, fix validation of bs and count to <= 0.

Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>

BUG: 2645 (volume top write-perf results in memory corruption)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2645
This commit is contained in:
shishir gowda 2011-04-01 03:24:12 +00:00 committed by Vijay Bellur
parent 5c709704ab
commit cd4fd271c6
2 changed files with 3 additions and 3 deletions

View File

@ -1343,7 +1343,7 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
ret = gf_is_str_int (value);
if (!ret)
blk_size = atoi (value);
if (ret || (blk_size < 0)) {
if (ret || (blk_size <= 0)) {
cli_out ("block size should be an integer "
"greater than zero");
ret = -1;
@ -1354,7 +1354,7 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
ret = gf_is_str_int (value);
if (!ret)
count = atoi(value);
if (ret || (count < 0)) {
if (ret || (count <= 0)) {
cli_out ("count should be an integer greater "
"zero");
ret = -1;

View File

@ -1783,7 +1783,7 @@ gf_is_str_int (const char *value)
GF_VALIDATE_OR_GOTO ("", value, out);
str = strdup (value);
str = gf_strdup (value);
if (!str)
goto out;