Commit 1bfb1070 authored by unknown's avatar unknown
Browse files

Fix for BUG#10107: Memory leak in view over subquery:

In mysql_make_view when joining subquery lists, take into account that both lists
can have length > 1 (see also fix for BUG#8490) 
(note to bk trigger: this commit is about BUG#10107)


sql/sql_view.cc:
  Fix for BUG#10107: In mysql_make_view, when joining subquery lists, take into account 
  that both lists can have length > 1 (see also fix for BUG#8490)
parent 8d44b2d3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -808,13 +808,15 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
        NOTE: we do not support UNION here, so we take only one select
      */
      SELECT_LEX_NODE *end_unit= table->select_lex->slave;
      SELECT_LEX_UNIT *next_unit;
      for (SELECT_LEX_UNIT *unit= lex->select_lex.first_inner_unit();
           unit;
           unit= unit->next_unit())
           unit= next_unit)
      {
        SELECT_LEX_NODE *save_slave= unit->slave;
        if (unit == end_unit)
          break;
        SELECT_LEX_NODE *save_slave= unit->slave;
        next_unit= unit->next_unit();
        unit->include_down(table->select_lex);
        unit->slave= save_slave; // fix include_down initialisation
      }