mirror of
https://github.com/MariaDB/server.git
synced 2026-05-04 14:15:33 +02:00
Fixed bug #915222.
This bug happened because the function find_field_in_view formed autogenerated names of view columns without a possibility to roll them back. In some situation it could cause memory misuses reported by valgrind or even crashes.
This commit is contained in:
parent
2149a42928
commit
4ca9b8eb3a
5 changed files with 82 additions and 9 deletions
|
|
@ -5988,15 +5988,22 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
|
|||
*/
|
||||
if (*ref && !(*ref)->is_autogenerated_name)
|
||||
{
|
||||
if (register_tree_change &&
|
||||
thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute())
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
item->set_name((*ref)->name, (*ref)->name_length,
|
||||
system_charset_info);
|
||||
item->real_item()->set_name((*ref)->name, (*ref)->name_length,
|
||||
system_charset_info);
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
if (register_tree_change)
|
||||
{
|
||||
item->set_name_for_rollback(thd, (*ref)->name,
|
||||
(*ref)->name_length,
|
||||
system_charset_info);
|
||||
item->real_item()->set_name_for_rollback(thd, (*ref)->name,
|
||||
(*ref)->name_length,
|
||||
system_charset_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
item->set_name((*ref)->name, (*ref)->name_length,
|
||||
system_charset_info);
|
||||
item->real_item()->set_name((*ref)->name, (*ref)->name_length,
|
||||
system_charset_info);
|
||||
}
|
||||
}
|
||||
if (register_tree_change)
|
||||
thd->change_item_tree(ref, item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue