diff options
author | davi@endora.local <> | 2007-11-01 18:52:56 -0200 |
---|---|---|
committer | davi@endora.local <> | 2007-11-01 18:52:56 -0200 |
commit | cc007acb785d12cb6f5f176320ad9d099937fd9c (patch) | |
tree | 6665bd29057800c65aa07195e3d351558f7d3173 /sql/event_db_repository.cc | |
parent | 6bd9f5c1cb1875b1a0b962a29c408f299222479e (diff) | |
download | mariadb-git-cc007acb785d12cb6f5f176320ad9d099937fd9c.tar.gz |
Bug#30882 Dropping a temporary table inside a stored function may cause a server crash
If a stored function that contains a drop temporary table statement
is invoked by a create temporary table of the same name may cause
a server crash. The problem is that when dropping a table no check
is done to ensure that table is not being used by some outer query
(or outer statement), potentially leaving the outer query with a
reference to a stale (freed) table.
The solution is when dropping a temporary table, always check if
the table is being used by some outer statement as a temporary
table can be dropped inside stored procedures.
The check is performed by looking at the TABLE::query_id value for
temporary tables. To simplify this check and to solve a bug related
to handling of temporary tables in prelocked mode, this patch changes
the way in which this member is used to track the fact that table is
used/unused. Now we ensure that TABLE::query_id is zero for unused
temporary tables (which means that all temporary tables which were
used by a statement should be marked as free for reuse after it's
execution has been completed).
Diffstat (limited to 'sql/event_db_repository.cc')
-rw-r--r-- | sql/event_db_repository.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 4451e763ff7..9a33b33d8c9 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -549,7 +549,7 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type, if (simple_open_n_lock_tables(thd, &tables)) { - close_thread_tables(thd, FALSE, FALSE); + close_thread_tables(thd); DBUG_RETURN(TRUE); } |