From 9e22cae1cfcb4fce7a6469e9b136d599efe6b87c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 23 May 2018 23:30:14 +0200 Subject: [PATCH] embedded use-after-free ASAN error Close MYSQL (and destroy THD) in the same thread where it was used, because THD embeds MDL_context, that owns some LF_PINS, that remember a pointer to my_thread_var->stack_ends_here. --- client/mysqltest.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 5ab84323a76..620a3417ac3 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -903,6 +903,8 @@ pthread_handler_t connection_thread(void *arg) end_thread: cn->query_done= 1; + mysql_close(cn->mysql); + cn->mysql= 0; mysql_thread_end(); pthread_exit(0); return 0;