Skip to content

Commit

Permalink
Fix memory leak on 'ssl_params' fetch in Monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierJF committed Jan 17, 2025
1 parent 2726c27 commit 15f5d75
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/MySQL_Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1546,10 +1546,12 @@ bool MySQL_Monitor_State_Data::set_wait_timeout() {
bool MySQL_Monitor_State_Data::create_new_connection() {
mysql=mysql_init(NULL);
assert(mysql);
MySQLServers_SslParams * ssl_params = NULL;
std::unique_ptr<MySQLServers_SslParams> ssl_params { nullptr };
if (use_ssl && port) {
ssl_params = MyHGM->get_Server_SSL_Params(hostname, port, mysql_thread___monitor_username);
MySQL_Connection::set_ssl_params(mysql,ssl_params);
ssl_params = std::unique_ptr<MySQLServers_SslParams>(
MyHGM->get_Server_SSL_Params(hostname, port, mysql_thread___monitor_username)
);
MySQL_Connection::set_ssl_params(mysql, ssl_params.get());
mysql_options(mysql, MARIADB_OPT_SSL_KEYLOG_CALLBACK, (void*)proxysql_keylog_write_line_callback);
}
unsigned int timeout=mysql_thread___monitor_connect_timeout/1000;
Expand Down

0 comments on commit 15f5d75

Please sign in to comment.