mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-24084 Fix race between disconnect and KILL CONNECTION
Prior to this patch, it is possible to access freed memory (THD::event_scheduler) from tp_post_kill_notification(). With this patch, memory is freed only when THD is no more accessible from other threads, i.e after it is removed from the thread_list.
This commit is contained in:
@@ -202,12 +202,11 @@ void tp_callback(TP_connection *c)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
c->thd= 0;
|
c->thd= 0;
|
||||||
delete c;
|
|
||||||
|
|
||||||
if (thd)
|
if (thd)
|
||||||
{
|
{
|
||||||
threadpool_remove_connection(thd);
|
threadpool_remove_connection(thd);
|
||||||
}
|
}
|
||||||
|
delete c;
|
||||||
worker_context.restore();
|
worker_context.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user