diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 0273ef8a1..b80752114 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -103,7 +103,7 @@ class ConsumerThread : public Thread { m_queue.add(item); } // this is intentional to EXIT immediately - return NULL; + goto cleanup; } @@ -123,6 +123,9 @@ class ConsumerThread : public Thread { delete item->data; delete item; } +cleanup: + // De-initializes per-thread structures. Required in all auxiliary threads using MySQL and SSL. + mysql_thread_end(); return NULL; } }; diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index c529cfbdd..ac23d0e87 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -329,6 +329,8 @@ __exit_kill_query_thread: delete ssl_params; ssl_params = NULL; } + // De-initializes per-thread structures. Required in all auxiliary threads using MySQL and SSL. + mysql_thread_end(); return NULL; }