From 67ae1ee3bd1c63aecf428cc080d7dbc22dd2d873 Mon Sep 17 00:00:00 2001 From: Valentin Rakush Date: Sat, 9 Nov 2019 19:05:12 +0000 Subject: [PATCH] Fix memory leak of servers in monitor connection pool --- lib/MySQL_Monitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 0a11fb394..ff327e960 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -161,13 +161,13 @@ private: PtrArray *conns; #endif // DEBUG // std::map, std::vector > my_connections; - PtrArray *servers; + std::unique_ptr servers; public: MYSQL * get_connection(char *hostname, int port, MySQL_Monitor_State_Data *mmsd); void put_connection(char *hostname, int port, MYSQL *my); void purge_some_connections(); MySQL_Monitor_Connection_Pool() { - servers = new PtrArray(); + servers = std::unique_ptr(new PtrArray()); #ifdef DEBUG conns = new PtrArray(); pthread_mutex_init(&m2, NULL);