Commit cc558cfb authored by unknown's avatar unknown

Fix for valgrind warning introduced by the fix for bug#21354:

(COUNT(*) = 1) not working in SELECT inside prepared statement.
Note: the warning was introduced in 5.0 and 5.1, 4.1 is OK with the
original fix.

The problem was that in 5.0 and 5.1 clear() for group functions may
access hybrid_type member, and this member is initialized in
fix_fields().

So we should not call clear() from item cleanup() methods, as cleanup()
may be called for unfixed items.


sql/item_sum.cc:
  Do not call clear() from item cleanup() methods, as cleanup() may be
  called for unfixed items, and clear() assumes the item was fixed.
sql/item_sum.h:
  Do not call clear() from item cleanup() methods, as cleanup() may be
  called for unfixed items, and clear() assumes the item was fixed.
parent 687bb161
......@@ -1055,7 +1055,7 @@ longlong Item_sum_count::val_int()
void Item_sum_count::cleanup()
{
DBUG_ENTER("Item_sum_count::cleanup");
clear();
count= 0;
Item_sum_int::cleanup();
used_table_cache= ~(table_map) 0;
DBUG_VOID_RETURN;
......
......@@ -643,8 +643,8 @@ public:
Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
void cleanup()
{
clear();
Item_sum_num::cleanup();
count= 0;
Item_sum_sum::cleanup();
}
};
......@@ -727,7 +727,8 @@ public:
enum Item_result result_type () const { return REAL_RESULT; }
void cleanup()
{
clear();
cur_dec= 0;
count= 0;
Item_sum_num::cleanup();
}
};
......@@ -862,7 +863,7 @@ public:
{ decimals= 0; max_length=21; unsigned_flag= 1; maybe_null= null_value= 0; }
void cleanup()
{
clear();
bits= reset_bits;
Item_sum_int::cleanup();
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment