diff options
author | Tor Didriksen <tor.didriksen@sun.com> | 2009-10-28 11:07:30 +0100 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@sun.com> | 2009-10-28 11:07:30 +0100 |
commit | dc2e363e57b5782f703290adfbfb8ead5f16ea53 (patch) | |
tree | 569cf4691c918df46c9d933b2e5ef9f56a1217b4 /sql/opt_sum.cc | |
parent | 48c15f0fb0a21c775398e34357f6425501a27914 (diff) | |
download | mariadb-git-dc2e363e57b5782f703290adfbfb8ead5f16ea53.tar.gz |
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.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 12 |
1 files changed, 6 insertions, 6 deletions
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<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. */ |