diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 31eaf4111ce..dd47dfb88af 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1511,13 +1511,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->transaction.stmt.reset(); - thd->protocol->end_statement(); - query_cache_end_of_result(thd); - thd->proc_info= "closing tables"; /* Free tables */ close_thread_tables(thd); + thd->protocol->end_statement(); + query_cache_end_of_result(thd); + if (!thd->is_error() && !thd->killed_errno()) mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_RESULT, 0, 0);