diff options
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 3884cce8451..3e1b643fecc 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -283,7 +283,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) comparators= 0; return 1; } - if (!(comparators= (Arg_comparator *) sql_alloc(sizeof(Arg_comparator)*n))) + if (!(comparators= new Arg_comparator[n])) return 1; for (uint i=0; i < n; i++) { @@ -1825,6 +1825,12 @@ in_row::in_row(uint elements, Item * item) size= sizeof(cmp_item_row); compare= (qsort2_cmp) cmp_row; tmp.store_value(item); + /* + We need to reset these as otherwise we will call sort() with + uninitialized (even if not used) elements + */ + used_count= elements; + collation= 0; } in_row::~in_row() |