1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-32466: Potential memory leak on executing of create view statement

This is the follow-up patch that removes explicit use of thd->stmt_arena
for memory allocation and replaces it with call of the method
  THD::active_stmt_arena_to_use()
Additionally, this patch adds extra DBUG_ASSERT to check that right
query arena is in use.
This commit is contained in:
Dmitry Shulga
2023-11-24 16:28:31 +07:00
parent 5064750fbf
commit 85f2e4f8e8
10 changed files with 49 additions and 15 deletions

View File

@ -240,7 +240,10 @@ bool table_value_constr::prepare(THD *thd, SELECT_LEX *sl,
if (!holders)
{
holders= type_holders= new (thd->stmt_arena->mem_root) Type_holder[cnt];
DBUG_ASSERT(thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute() ||
thd->stmt_arena->is_conventional());
holders= type_holders=
new (thd->active_stmt_arena_to_use()->mem_root) Type_holder[cnt];
if (!holders ||
join_type_handlers_for_tvc(thd, li, holders, cnt) ||
get_type_attributes_for_tvc(thd, li, holders,