Commit 51064c05 authored by sergefp@mysql.com's avatar sergefp@mysql.com

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)
parent d7a1549b
...@@ -808,13 +808,15 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) ...@@ -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 NOTE: we do not support UNION here, so we take only one select
*/ */
SELECT_LEX_NODE *end_unit= table->select_lex->slave; 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(); for (SELECT_LEX_UNIT *unit= lex->select_lex.first_inner_unit();
unit; unit;
unit= unit->next_unit()) unit= next_unit)
{ {
SELECT_LEX_NODE *save_slave= unit->slave;
if (unit == end_unit) if (unit == end_unit)
break; break;
SELECT_LEX_NODE *save_slave= unit->slave;
next_unit= unit->next_unit();
unit->include_down(table->select_lex); unit->include_down(table->select_lex);
unit->slave= save_slave; // fix include_down initialisation unit->slave= save_slave; // fix include_down initialisation
} }
......
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