summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-03-09 16:42:45 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2016-03-09 16:42:45 +0100
commit35e713dcca0207c1dc9459fc9cd7c3913cbe0be7 (patch)
treeb58d5225188a725525599a51295374e58c94e93d /sql/threadpool_common.cc
parent351026ca535179abb956c5ad1e1d59aac0835254 (diff)
downloadmariadb-git-35e713dcca0207c1dc9459fc9cd7c3913cbe0be7.tar.gz
Fix leak from missing my_thread_end
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r--sql/threadpool_common.cc23
1 files changed, 7 insertions, 16 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 1653075a916..2cfa3473222 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -182,27 +182,13 @@ THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
}
if (error)
{
- threadpool_cleanup_connection(thd);
+ threadpool_remove_connection(thd);
thd= NULL;
}
worker_context.restore();
return thd;
}
-/*
- threadpool_cleanup_connection() does the bulk of connection shutdown work.
- Usually called from threadpool_remove_connection(), but rarely it might
- be called also in the main polling thread if connection initialization fails.
-*/
-void threadpool_cleanup_connection(THD *thd)
-{
- thd->net.reading_or_writing = 0;
- end_connection(thd);
- close_connection(thd, 0);
- unlink_thd(thd);
- mysql_cond_broadcast(&COND_thread_count);
-}
-
void threadpool_remove_connection(THD *thd)
{
@@ -210,7 +196,12 @@ void threadpool_remove_connection(THD *thd)
worker_context.save();
thread_attach(thd);
- threadpool_cleanup_connection(thd);
+ thd->net.reading_or_writing = 0;
+ end_connection(thd);
+ close_connection(thd, 0);
+ unlink_thd(thd);
+ mysql_cond_broadcast(&COND_thread_count);
+
/*
Free resources associated with this connection:
mysys thread_var and PSI thread.