summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <tsmith@ramayana.hindu.god>2007-10-10 14:00:57 -0600
committerunknown <tsmith@ramayana.hindu.god>2007-10-10 14:00:57 -0600
commit80ace294160241e48e211965ad412ad1d4806f73 (patch)
treef1931f4b6b596a733e55a7ecbea7f547d7aa4611 /sql/sql_class.cc
parente33a069c8c890fc3698bfa42a92f33d7844fe54e (diff)
downloadmariadb-git-80ace294160241e48e211965ad412ad1d4806f73.tar.gz
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: It is possible that mark_transaction_to_rollback() may be called in rare circumstances when thd is NULL (e.g., from some calls to convert_error_code_to_mysql()). Don't use thd if it is NULL.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc7
1 files 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