summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-10-18 15:20:34 +0400
committerunknown <kroki/tomash@moonlight.intranet>2006-10-18 15:20:34 +0400
commitcc558cfba34ee39cf447849626db09e7b252ab9d (patch)
tree3071284c76e6215d28922aae4665880034ccf789 /sql
parent687bb16165d1d5b6c09eafc22f026490134b087b (diff)
downloadmariadb-git-cc558cfba34ee39cf447849626db09e7b252ab9d.tar.gz
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.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/item_sum.h9
2 files changed, 6 insertions, 5 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 513fa46ecb3..397293bc131 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -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;
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 4a0930184c7..fe7edd76ecf 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -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();
}
};