MDEV-6441: memory leak

mysql_derived_prepare() was executed on the statement memory.
Now it is executed on the runtime memory.
All bugs induced by this were fixed.
This commit is contained in:
unknown 2014-07-31 10:11:10 +03:00
commit a270e8abc4
5 changed files with 122 additions and 7 deletions

View file

@ -614,6 +614,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX_UNIT *unit= derived->get_unit();
DBUG_ENTER("mysql_derived_prepare");
bool res= FALSE;
DBUG_PRINT("enter", ("unit 0x%lx", (ulong) unit));
// Skip already prepared views/DT
if (!unit || unit->prepared ||
@ -623,9 +624,6 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
thd->lex->sql_command == SQLCOM_DELETE_MULTI))))
DBUG_RETURN(FALSE);
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
SELECT_LEX *first_select= unit->first_select();
/* prevent name resolving out of derived table */
@ -743,8 +741,6 @@ exit:
if (derived->outer_join)
table->maybe_null= 1;
}
if (arena)
thd->restore_active_arena(arena, &backup);
DBUG_RETURN(res);
}