1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Bug#48060 Memory leak - Item::val_bool() (item.cc:184) from optimizer_subquery grammar

Item_sum::set_aggregator() may be called multiple times during query preparation.
On subsequent calls: verify that the aggregator type is the same,
and re-use the existing Aggregator.


sql/item_sum.cc:
  In Item_sum::set_aggregator(): re-use existing Aggregator if already set.
  
  Remove some friend declarations, add some accessor functions.
  Cleanup some DBUG_ENTER and DBUG_RETURN code.
sql/item_sum.h:
  Make some member fields private, add accessors instead.
  Remove some un-necessary friend declarations.
  Remove some default arguments from constructors.
sql/opt_sum.cc:
  Use accessor functions in Item_sum.
sql/sql_select.cc:
  Fix mis-spelled DBUG_ENTER text.
  Use accessor functions in Item_sum.
sql/sql_yacc.yy:
  Use explicit true/false rather than default arguments when constructing
  Item_sum_xxx objects.
This commit is contained in:
Tor Didriksen
2009-10-28 11:07:30 +01:00
parent 55b8f07a99
commit b2baeed4a7
5 changed files with 53 additions and 43 deletions

View File

@@ -356,9 +356,9 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
const_result= 0;
break;
}
item_sum->set_aggregator (item_sum->with_distinct ?
Aggregator::DISTINCT_AGGREGATOR :
Aggregator::SIMPLE_AGGREGATOR);
item_sum->set_aggregator(item_sum->has_with_distinct() ?
Aggregator::DISTINCT_AGGREGATOR :
Aggregator::SIMPLE_AGGREGATOR);
if (!count)
{
/* If count == 0, then we know that is_exact_count == TRUE. */
@@ -447,9 +447,9 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
const_result= 0;
break;
}
item_sum->set_aggregator (item_sum->with_distinct ?
Aggregator::DISTINCT_AGGREGATOR :
Aggregator::SIMPLE_AGGREGATOR);
item_sum->set_aggregator(item_sum->has_with_distinct() ?
Aggregator::DISTINCT_AGGREGATOR :
Aggregator::SIMPLE_AGGREGATOR);
if (!count)
{
/* If count != 1, then we know that is_exact_count == TRUE. */