diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index d4687712b..38c37c3d8 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -2714,10 +2714,7 @@ MySQL_Thread::~MySQL_Thread() { #endif // IDLE_THREADS if (cached_connections) { - while(cached_connections->len) { - MySQL_Connection *c=(MySQL_Connection *)cached_connections->remove_index_fast(0); - delete c; - } + return_local_connections(); delete cached_connections; }