From dc2e363e57b5782f703290adfbfb8ead5f16ea53 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 28 Oct 2009 11:07:30 +0100 Subject: 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/opt_sum.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sql/opt_sum.cc') diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 9d546b24c7c..13b10ac2e8f 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -356,9 +356,9 @@ int opt_sum_query(TABLE_LIST *tables, List &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 &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. */ -- cgit v1.2.1