1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix leak from missing my_thread_end

This commit is contained in:
Vladislav Vaintroub
2016-03-09 16:42:45 +01:00
parent 351026ca53
commit 35e713dcca
2 changed files with 7 additions and 17 deletions

View File

@ -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.