From 45d4f6b97b4811b1b7783dcd19526be1dbb196dc Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 12 Apr 2023 15:08:23 +0200 Subject: MDEV-30889: 2 - Allocation in TABLE_SHARE::init_from_sql_statement_string Fix leack in TABLE_SHARE::init_from_sql_statement_string by removing uneeded switching arenas. --- sql/table.cc | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/sql/table.cc b/sql/table.cc index d96e9248cd1..fd5334271be 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3163,7 +3163,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, char *sql_copy; handler *file; LEX *old_lex; - Query_arena *arena, backup; LEX tmp_lex; KEY *unused1; uint unused2; @@ -3172,12 +3171,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, LEX_CSTRING db_backup= thd->db; DBUG_ENTER("TABLE_SHARE::init_from_sql_statement_string"); - /* - Ouch. Parser may *change* the string it's working on. - Currently (2013-02-26) it is used to permanently disable - conditional comments. - Anyway, let's copy the caller's string... - */ if (!(sql_copy= thd->strmake(sql, sql_length))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3190,12 +3183,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, old_lex= thd->lex; thd->lex= &tmp_lex; - arena= thd->stmt_arena; - if (arena->is_conventional()) - arena= 0; - else - thd->set_n_backup_active_arena(arena, &backup); - thd->reset_db(&db); lex_start(thd); @@ -3230,8 +3217,6 @@ ret: lex_end(thd->lex); thd->reset_db(&db_backup); thd->lex= old_lex; - if (arena) - thd->restore_active_arena(arena, &backup); reenable_binlog(thd); thd->variables.sql_mode= saved_mode; thd->variables.character_set_client= old_cs; -- cgit v1.2.1