summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/sql_prepare.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index ab136668cfb..0285c1eec2f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1083,7 +1083,11 @@ static void reset_stmt_for_execute(Prepared_statement *stmt)
tables;
tables= tables->next)
{
- tables->table= 0; // safety - nasty init
+ /*
+ Reset old pointers to TABLEs: they are not valid since the tables
+ were closed in the end of previous prepare or execute call.
+ */
+ tables->table= 0;
tables->table_list= 0;
}