summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2013-10-14 21:23:09 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2013-10-14 21:23:09 +0500
commit4e243be509e7bf7f5cdc58555a86eed2d44c6872 (patch)
tree41c73a2be096ba5b67bc210b12f8c998dd13403d /libmysqld
parentc7db46a2427e933a379d0a8c62221c344a29ea06 (diff)
downloadmariadb-git-4e243be509e7bf7f5cdc58555a86eed2d44c6872.tar.gz
MDEV-5131 create_embedded_thd is not thread safe, libmysqld.
The emb_free_embedded_thd() has the thread-unsafe code so should be 'mutexed' also.
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/lib_sql.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index d5e5ecca2f5..1b632213376 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -416,11 +416,13 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row)
static void emb_free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
+ mysql_mutex_lock(&LOCK_thread_count);
thd->clear_data_list();
thread_count--;
thd->store_globals();
thd->unlink();
delete thd;
+ mysql_mutex_unlock(&LOCK_thread_count);
my_pthread_setspecific_ptr(THR_THD, 0);
mysql->thd=0;
}