Skip to content

Commit

Permalink
MDEV-30889: 2 - Allocation in TABLE_SHARE::init_from_sql_statement_st…
Browse files Browse the repository at this point in the history
…ring

 Fix leack in TABLE_SHARE::init_from_sql_statement_string
 by removing uneeded switching arenas.
  • Loading branch information
sanja-byelkin committed Apr 26, 2023
1 parent 348f4c9 commit 45d4f6b
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions sql/table.cc
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -3230,8 +3217,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
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;
Expand Down

0 comments on commit 45d4f6b

Please sign in to comment.