summaryrefslogtreecommitdiff
path: root/sql/uniques.cc
diff options
context:
space:
mode:
authormonty@mashka.mysql.fi <>2003-06-26 07:56:55 +0300
committermonty@mashka.mysql.fi <>2003-06-26 07:56:55 +0300
commit5f556f11e0e0ef0daefd41829cd400cc7addb583 (patch)
tree80a9ea494fdef18a20b754a4ce6bfd8179e5cfe0 /sql/uniques.cc
parent7655f05dc2377b3df8b9fabb0e622781f65d5b60 (diff)
downloadmariadb-git-5f556f11e0e0ef0daefd41829cd400cc7addb583.tar.gz
Fixed memory allocation in Unique to not allocate too much memory
Diffstat (limited to 'sql/uniques.cc')
-rw-r--r--sql/uniques.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/uniques.cc b/sql/uniques.cc
index ed256a4b791..d00893a8605 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -49,8 +49,8 @@ int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
}
Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
- uint size, ulong max_in_memory_size_arg)
- :max_in_memory_size(max_in_memory_size_arg),elements(0)
+ uint size_arg, ulong max_in_memory_size_arg)
+ :max_in_memory_size(max_in_memory_size_arg), size(size_arg), elements(0)
{
my_b_clear(&file);
init_tree(&tree, max_in_memory_size / 16, 0, size, comp_func, 0, NULL,
@@ -101,7 +101,7 @@ bool Unique::get(TABLE *table)
{
/* Whole tree is in memory; Don't use disk if you don't need to */
if ((record_pointers=table->record_pointers= (byte*)
- my_malloc(tree.size_of_element * tree.elements_in_tree, MYF(0))))
+ my_malloc(size * tree.elements_in_tree, MYF(0))))
{
(void) tree_walk(&tree, (tree_walk_action) unique_write_to_ptrs,
this, left_root_right);