Skip to content

Commit 96b7671

Browse files
committed
MDEV-34388 fixup: Stack usage in rename_table_in_stat_tables()
rename_table_in_stat_tables(): Allocate TABLE_LIST[STATISTICS_TABLES] from the heap instead of the stack, to pass -Wframe-larger-than=16384 in an optimized CMAKE_BUILD_TYPE=RelWithDebInfo build.
1 parent 69af638 commit 96b7671

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

sql/sql_statistics.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,16 +4023,24 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db,
40234023
int err;
40244024
enum_binlog_format save_binlog_format;
40254025
TABLE *stat_table;
4026-
TABLE_LIST tables[STATISTICS_TABLES];
40274026
int rc= 0;
40284027
DBUG_ENTER("rename_table_in_stat_tables");
4029-
4028+
4029+
TABLE_LIST *tables=
4030+
static_cast<TABLE_LIST*>(my_malloc(PSI_NOT_INSTRUMENTED,
4031+
STATISTICS_TABLES * sizeof *tables,
4032+
MYF(MY_WME)));
4033+
if (!tables)
4034+
DBUG_RETURN(1);
4035+
40304036
start_new_trans new_trans(thd);
40314037

40324038
if (open_stat_tables(thd, tables, TRUE))
40334039
{
4040+
func_exit:
4041+
my_free(tables);
40344042
new_trans.restore_old_transaction();
4035-
DBUG_RETURN(0);
4043+
DBUG_RETURN(rc);
40364044
}
40374045

40384046
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
@@ -4093,9 +4101,7 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db,
40934101
thd->restore_stmt_binlog_format(save_binlog_format);
40944102
if (thd->commit_whole_transaction_and_close_tables())
40954103
rc= 1;
4096-
4097-
new_trans.restore_old_transaction();
4098-
DBUG_RETURN(rc);
4104+
goto func_exit;
40994105
}
41004106

41014107

0 commit comments

Comments
 (0)