diff options
author | Jorgen Loland <jorgen.loland@sun.com> | 2009-11-13 12:22:39 +0100 |
---|---|---|
committer | Jorgen Loland <jorgen.loland@sun.com> | 2009-11-13 12:22:39 +0100 |
commit | a120e969a83128f075b54a06155ccee0bb46b312 (patch) | |
tree | 647243c578e4358668d708f8fb7854fc8b3d9d76 /sql/sql_select.cc | |
parent | cf872354a8b20daced728a9c76c4d25648f88da8 (diff) | |
download | mariadb-git-a120e969a83128f075b54a06155ccee0bb46b312.tar.gz |
Bug#48052: Valgrind warning - uninitialized value in
init_read_record() - (records.cc:274)
Item_cond::used_tables_cache was accessed in
records.cc#init_read_record() without being initialized. It had
not been initialized because it was wrongly assumed that the
Item's variables would not be accessed, and hence
quick_fix_field() was used instead of fix_fields() to save a few
CPU cycles at creation time.
The fix is to properly initilize the Item by replacing
quick_fix_field() with fix_fields().
mysql-test/r/select.result:
Add test for BUG#48052
mysql-test/t/select.test:
Add test for BUG#48052
sql/sql_select.cc:
Properly initialize Item_cond_and by calling fix_fields (instead of quick_fix_field) when the Item that "ANDs" WHERE clause conditions with HAVING clause conditions is created.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7a4ab1c8365..00080b9b9d9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2131,17 +2131,13 @@ JOIN::exec() DBUG_VOID_RETURN; if (!curr_table->select->cond) curr_table->select->cond= sort_table_cond; - else // This should never happen + else { if (!(curr_table->select->cond= new Item_cond_and(curr_table->select->cond, sort_table_cond))) DBUG_VOID_RETURN; - /* - Item_cond_and do not need fix_fields for execution, its parameters - are fixed or do not need fix_fields, too - */ - curr_table->select->cond->quick_fix_field(); + curr_table->select->cond->fix_fields(thd, 0); } curr_table->select_cond= curr_table->select->cond; curr_table->select_cond->top_level_item(); |