1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir

Fix a regression introduced in MDEV-35840 78157c4765

Also tested compiling with -O3 that the -Warray-bounds fixed in
MDEV-35840 does not resurface
This commit is contained in:
Yuchen Pei
2025-02-24 12:10:32 +11:00
parent f3687ccaaf
commit 0fa141ebb4
3 changed files with 22 additions and 3 deletions

View File

@@ -25,3 +25,9 @@ OPENED_VIEWS 0
set @@use_stat_tables= @save_use_stat_tables;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1;
#
# MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir
#
create table t1 (c int);
drop table t1;
# restart

View File

@@ -24,4 +24,15 @@ select variable_name, session_status.variable_value - t1.variable_value
from information_schema.session_status join t1 using (variable_name);
set @@use_stat_tables= @save_use_stat_tables;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1;
drop table t1;
--echo #
--echo # MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir
--echo #
create table t1 (c int);
let $MYSQLD_TMPDIR=`SELECT @@tmpdir`;
let $MYSQLD_DATADIR=`SELECT @@datadir`;
--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_TMPDIR/#sqlt1.frm
drop table t1;
--source include/restart_mysqld.inc

View File

@@ -8986,9 +8986,11 @@ my_bool mysql_rm_tmp_tables(void)
memcpy(path_copy, path, path_len - ext_len);
path_copy[path_len - ext_len]= 0;
init_tmp_table_share(thd, &share, "", 0, "", path_copy);
handlerton *ht= share.db_type();
if (!open_table_def(thd, &share))
ht->drop_table(share.db_type(), path_copy);
{
handlerton *ht= share.db_type();
ht->drop_table(ht, path_copy);
}
free_table_share(&share);
}
/*