From ced64f85823c7a9dcd6b9f952c136278567fa9f6 Mon Sep 17 00:00:00 2001 From: "tsmith@ramayana.hindu.god" <> Date: Wed, 10 Oct 2007 14:00:57 -0600 Subject: [PATCH] Bug #31517: Potential crash due to access of NULL thd in mark_transaction_to_rollback() Introduced in mark_transaction_to_rollback(), part of fix for bug 24989; fix is to check thd for NULL before using it. --- sql/sql_class.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b67f63778dc..4a98a044e25 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2241,8 +2241,11 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) void mark_transaction_to_rollback(THD *thd, bool all) { - thd->is_fatal_sub_stmt_error= TRUE; - thd->transaction_rollback_request= all; + if (thd) + { + thd->is_fatal_sub_stmt_error= TRUE; + thd->transaction_rollback_request= all; + } } /*************************************************************************** Handling of XA id cacheing