summaryrefslogtreecommitdiff
path: root/client/mysqlslap.c
diff options
context:
space:
mode:
authorunknown <knielsen@mysql.com>2006-01-03 11:09:18 +0100
committerunknown <knielsen@mysql.com>2006-01-03 11:09:18 +0100
commita74472c849037c97ee44b80336f045ab19607829 (patch)
tree867c7e3a05825f0aaeea643827f98a5eff75f3d0 /client/mysqlslap.c
parenta34b7ee82cdcddd83ad96403c80d1f23c7797ce0 (diff)
downloadmariadb-git-a74472c849037c97ee44b80336f045ab19607829.tar.gz
Fix memory problem: Both the allocation and pointer arithmetics on the
head_sptr array was wrong.
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r--client/mysqlslap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 13d44d70bd7..d371387de10 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -281,7 +281,7 @@ int main(int argc, char **argv)
stats *head_sptr;
stats *sptr;
- head_sptr= (stats *)my_malloc(sizeof(stats) * *current, MYF(MY_ZEROFILL));
+ head_sptr= (stats *)my_malloc(sizeof(stats) * iterations, MYF(MY_ZEROFILL));
bzero(&conclusion, sizeof(conclusions));
@@ -290,7 +290,7 @@ int main(int argc, char **argv)
else
client_limit= actual_queries;
- for (x= 0, sptr= head_sptr; x < iterations; x++, sptr+= sizeof(stats))
+ for (x= 0, sptr= head_sptr; x < iterations; x++, sptr++)
{
/*
We might not want to load any data, such as when we are calling
@@ -1192,7 +1192,7 @@ generate_stats(conclusions *con, statement *eng, stats *sptr)
con->avg_rows= sptr->rows;
/* With no next, we know it is the last element that was malloced */
- for (ptr= sptr, x= 0; x < iterations; ptr+= sizeof(stats), x++)
+ for (ptr= sptr, x= 0; x < iterations; ptr++, x++)
{
con->avg_timing+= ptr->timing;