summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorGleb Shchepa <gshchepa@mysql.com>2009-12-01 14:38:40 +0400
committerGleb Shchepa <gshchepa@mysql.com>2009-12-01 14:38:40 +0400
commit60b76cd7296e3c8be363d5ca2e10c439d1d457ef (patch)
tree6c4e2c06804e3bc8ba86257835dc29db96a55e7a /sql/sql_class.cc
parent0dde5599bd2e2304b578856771c8c29b19577ceb (diff)
parentee136e3fa5d4d229b36eb079d1b4bb894d3084ff (diff)
downloadmariadb-git-60b76cd7296e3c8be363d5ca2e10c439d1d457ef.tar.gz
Bug #38883 (reopened): thd_security_context is not thread safe, crashes?
manual merge 5.0-->5.1, updating InnoDB plugin.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a12b0198c98..7b37a3f6e93 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -376,6 +376,8 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
str.append(proc_info);
}
+ pthread_mutex_lock(&thd->LOCK_thd_data);
+
if (thd->query())
{
if (max_query_len < 1)
@@ -385,6 +387,9 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
str.append('\n');
str.append(thd->query(), len);
}
+
+ pthread_mutex_unlock(&thd->LOCK_thd_data);
+
if (str.c_ptr_safe() == buffer)
return buffer;