← Back to team overview

maria-developers team mailing list archive

Rev 2797: Fixed valgrind failure in select_describe(), read of uninitialized in file:///home/psergey/dev/mariadb-5.1-knielsen/

 

At file:///home/psergey/dev/mariadb-5.1-knielsen/

------------------------------------------------------------
revno: 2797
revision-id: psergey@xxxxxxxxxxxx-20100309100049-n986bg9spx4mlamp
parent: knielsen@xxxxxxxxxxxxxxx-20100304080603-qq61atw8t0im9qf4
committer: Sergey Petrunya <psergey@xxxxxxxxxxxx>
branch nick: mariadb-5.1-knielsen
timestamp: Tue 2010-03-09 13:00:49 +0300
message:
  Fixed valgrind failure in select_describe(), read of uninitialized 
  Item_subselect::eliminated: 
  - it turns out we can call select_describe() without having fixed 
    subquery items for child subselects. These are not the kind of subqueries
    that we could eliminate, so the fix is to ensure that 
    item_subselect->eliminated==FALSE even before fix_fields is called.
    Also added code to reset item_subselect->eliminated back to FALSE in
    Item::reset() call.
=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2010-01-15 15:27:55 +0000
+++ b/sql/item_subselect.cc	2010-03-09 10:00:49 +0000
@@ -39,7 +39,8 @@
 Item_subselect::Item_subselect():
   Item_result_field(), value_assigned(0), thd(0), substitution(0),
   engine(0), old_engine(0), used_tables_cache(0), have_to_be_excluded(0),
-  const_item_cache(1), in_fix_fields(0), engine_changed(0), changed(0), is_correlated(FALSE)
+  const_item_cache(1), in_fix_fields(0), eliminated(FALSE), 
+  engine_changed(0), changed(0), is_correlated(FALSE)
 {
   with_subselect= 1;
   reset();
@@ -431,6 +432,7 @@
 
 void Item_singlerow_subselect::reset()
 {
+  eliminated= FALSE;
   null_value= 1;
   if (value)
     value->null_value= 1;

=== modified file 'sql/item_subselect.h'
--- a/sql/item_subselect.h	2010-01-15 15:27:55 +0000
+++ b/sql/item_subselect.h	2010-03-09 10:00:49 +0000
@@ -90,6 +90,7 @@
   void cleanup();
   virtual void reset()
   {
+    eliminated= FALSE;
     null_value= 1;
   }
   virtual trans_res select_transformer(JOIN *join);
@@ -235,6 +236,7 @@
   subs_type substype() { return EXISTS_SUBS; }
   void reset() 
   {
+    eliminated= FALSE;
     value= 0;
   }
 
@@ -306,6 +308,7 @@
   subs_type substype() { return IN_SUBS; }
   void reset() 
   {
+    eliminated= FALSE;
     value= 0;
     null_value= 0;
     was_null= 0;