Commit 868fee4d authored by unknown's avatar unknown

BUG#20919 temp tables closing fails when binlog is off

closing temp tables through end_thread
had a flaw in binlog-off branch of close_temporary_tables where
next table to close was reset via table->next
 for (table= thd->temporary_tables; table; table= table->next)
which was wrong since the current table instance got destoyed at
	close_temporary(table, 1);

The fix adapts binlog-on branch method to engage the loop's internal 'next' variable which holds table->next prior table's destoying.



sql/sql_base.cc:
  no-binlog branch is fixed: scanning across temporary_tables must be careful to save next table since the current is being destroyed inside of close_temporary. 
  binlog-is-open case is ok.
parent 5d506d6b
......@@ -499,8 +499,10 @@ void close_temporary_tables(THD *thd)
if (!mysql_bin_log.is_open())
{
for (table= thd->temporary_tables; table; table= table->next)
TABLE *next;
for (table= thd->temporary_tables; table; table= next)
{
next= table->next;
close_temporary(table, 1);
}
thd->temporary_tables= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment