Skip to content

Commit 98f7b2c

Browse files
MDEV-25663 Double free of transaction during truncate operation
InnoDB truncate table fails to load the fts stopword table into cache. In that case, InnoDB double frees the truncate creation transaction. InnoDB should free the transaction which was created inside ha_innobase::create.
1 parent c88e934 commit 98f7b2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13024,7 +13024,6 @@ create_table_info_t::create_table_update_dict()
1302413024
if (!innobase_fts_load_stopword(innobase_table, NULL, m_thd)) {
1302513025
dict_table_close(innobase_table, FALSE, FALSE);
1302613026
srv_active_wake_master_thread();
13027-
trx_free_for_mysql(m_trx);
1302813027
DBUG_RETURN(-1);
1302913028
}
1303013029

@@ -13169,6 +13168,12 @@ ha_innobase::create(
1316913168

1317013169
error = info.create_table_update_dict();
1317113170

13171+
/* In case of error, free the transaction only if
13172+
it is newly created transaction in ha_innobase::create() */
13173+
if (own_trx && error) {
13174+
trx_free_for_mysql(info.trx());
13175+
}
13176+
1317213177
/* Tell the InnoDB server that there might be work for
1317313178
utility threads: */
1317413179

0 commit comments

Comments
 (0)