diff options
author | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-07-07 13:55:09 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-07-07 13:55:09 +0200 |
commit | 223f42b7158fee3b2464e76654142c7cd55a415e (patch) | |
tree | d789ce85d5385b646c7c3e729aad9e929823ac75 /sql/sql_table.cc | |
parent | 9dba6ddfac25088c5b187f15370d949eb4a40896 (diff) | |
download | mariadb-git-223f42b7158fee3b2464e76654142c7cd55a415e.tar.gz |
Bug #54117 crash in thr_multi_unlock, temporary table
This crash occured after ALTER TABLE was used on a temporary
transactional table locked by LOCK TABLES. Any later attempts to
execute LOCK/UNLOCK TABLES, caused the server to crash.
The reason for the crash was the list of locked tables would
end up having a pointer to a free'd table instance. This happened
because ALTER TABLE deleted the table without also removing the
table reference from the locked tables list.
This patch fixes the problem by making sure ALTER TABLE also
removes the table from the locked tables list.
Test case added to innodb_mysql.test.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 50045ec6d90..6de461574d8 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7387,6 +7387,11 @@ view_err: mysql_unlock_tables(thd, thd->lock); thd->lock=0; } + /* + If LOCK TABLES list is not empty and contains this table, + unlock the table and remove the table from this list. + */ + mysql_lock_remove(thd, thd->locked_tables, table, FALSE); /* Remove link to old table and rename the new one */ close_temporary_table(thd, table, 1, 1); /* Should pass the 'new_name' as we store table name in the cache */ |