summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/connect.result16
-rw-r--r--mysql-test/t/connect.test18
-rw-r--r--sql/sql_class.cc4
3 files changed, 36 insertions, 2 deletions
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index edf30e7f6e4..293ad37c31a 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -65,3 +65,19 @@ show tables;
Tables_in_test
delete from mysql.user where user=_binary"test";
flush privileges;
+use test;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1 (id integer not null auto_increment primary key);
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+create temporary table t2(id integer not null auto_increment primary key);
+set @id := 1;
+delete from t1 where id like @id;
+use test;
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+drop table if exists t1;
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index 1a6dca5b69e..9acc18a0cee 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -77,4 +77,22 @@ show tables;
delete from mysql.user where user=_binary"test";
flush privileges;
+# Test for bug #12517.
+connect (con2,localhost,root,,test);
+connection con2;
+use test;
+drop table if exists t1;
+create table t1 (id integer not null auto_increment primary key);
+drop table if exists t2;
+create temporary table t2(id integer not null auto_increment primary key);
+set @id := 1;
+delete from t1 where id like @id;
+disconnect con2;
+sleep 5;
+connect (con1,localhost,root,,test);
+connection con1;
+use test;
+drop table if exists t2;
+drop table if exists t1;
+
# End of 4.1 tests
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index e845769d7ad..11b45b848c8 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -353,12 +353,12 @@ void THD::cleanup(void)
mysql_ha_flush(this, (TABLE_LIST*) 0,
MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL);
hash_free(&handler_tables_hash);
+ delete_dynamic(&user_var_events);
+ hash_free(&user_vars);
close_temporary_tables(this);
my_free((char*) variables.time_format, MYF(MY_ALLOW_ZERO_PTR));
my_free((char*) variables.date_format, MYF(MY_ALLOW_ZERO_PTR));
my_free((char*) variables.datetime_format, MYF(MY_ALLOW_ZERO_PTR));
- delete_dynamic(&user_var_events);
- hash_free(&user_vars);
if (global_read_lock)
unlock_global_read_lock(this);
if (ull)