diff options
author | unknown <gshchepa/uchum@gleb.loc> | 2007-07-28 23:10:38 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@gleb.loc> | 2007-07-28 23:10:38 +0500 |
commit | 90c5621d6c22ce86354ffe8ccd244007a5e4d846 (patch) | |
tree | 8d9e642af597b6fb2d289acdb1377f9569d34dea /sql/sql_base.cc | |
parent | 85603b2e0b6b51c57de7019f451461e676c458de (diff) | |
download | mariadb-git-90c5621d6c22ce86354ffe8ccd244007a5e4d846.tar.gz |
Fixed bug #29834.
Using view columns by their names during an execution of
a prepared SELECT statement or a SELECT statement inside
a SP caused a memory leak.
sql/sql_base.cc:
Fixed bug #29834.
The find_field_in_view function has been modified to
use the execution memory root for the Item_direct_view_ref
objects allocation at non-first executions of
a PS/SP instead of the statement memory.
mysql-test/t/sp.test:
Updated test case for bug #29834.
mysql-test/r/sp.result:
Updated test case for bug #29834.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ed006714143..deb46f0d932 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3435,7 +3435,7 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list, table_list->alias, name, item_name, (ulong) ref)); Field_iterator_view field_it; field_it.set(table_list); - Query_arena *arena, backup; + Query_arena *arena= 0, backup; DBUG_ASSERT(table_list->schema_table_reformed || (ref != 0 && table_list->view != 0)); @@ -3444,14 +3444,14 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list, if (!my_strcasecmp(system_charset_info, field_it.name(), name)) { // in PS use own arena or data will be freed after prepare - if (register_tree_change) + if (register_tree_change && thd->stmt_arena->is_stmt_prepare_or_first_sp_execute()) arena= thd->activate_stmt_arena_if_needed(&backup); /* create_item() may, or may not create a new Item, depending on the column reference. See create_view_field() for details. */ Item *item= field_it.create_item(thd); - if (register_tree_change && arena) + if (arena) thd->restore_active_arena(arena, &backup); if (!item) |