Skip to content

Commit

Permalink
Minor memory leak in PR #1922
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Mar 22, 2019
1 parent 6da427f commit adb1614
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/MySQL_Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2224,6 +2224,7 @@ MySQL_Threads_Handler::~MySQL_Threads_Handler() {
if (variables.default_schema) free(variables.default_schema);
if (variables.interfaces) free(variables.interfaces);
if (variables.server_version) free(variables.server_version);
if (variables.keep_multiplexing_variables) free(variables.keep_multiplexing_variables);
if (variables.init_connect) free(variables.init_connect);
if (variables.default_sql_mode) free(variables.default_sql_mode);
if (variables.default_time_zone) free(variables.default_time_zone);
Expand Down Expand Up @@ -2338,6 +2339,7 @@ MySQL_Thread::~MySQL_Thread() {
}
if (mysql_thread___default_schema) { free(mysql_thread___default_schema); mysql_thread___default_schema=NULL; }
if (mysql_thread___server_version) { free(mysql_thread___server_version); mysql_thread___server_version=NULL; }
if (mysql_thread___keep_multiplexing_variables) { free(mysql_thread___keep_multiplexing_variables); mysql_thread___keep_multiplexing_variables=NULL; }
if (mysql_thread___init_connect) { free(mysql_thread___init_connect); mysql_thread___init_connect=NULL; }
if (mysql_thread___default_sql_mode) { free(mysql_thread___default_sql_mode); mysql_thread___default_sql_mode=NULL; }
if (mysql_thread___default_time_zone) { free(mysql_thread___default_time_zone); mysql_thread___default_time_zone=NULL; }
Expand Down Expand Up @@ -3401,8 +3403,9 @@ void MySQL_Thread::refresh_variables() {
mysql_thread___eventslog_filename=GloMTH->get_variable_string((char *)"eventslog_filename");
GloMyLogger->set_base_filename(); // both filename and filesize are set here
if (mysql_thread___default_schema) free(mysql_thread___default_schema);
mysql_thread___keep_multiplexing_variables=GloMTH->get_variable_string((char *)"keep_multiplexing_variables");
mysql_thread___default_schema=GloMTH->get_variable_string((char *)"default_schema");
if (mysql_thread___keep_multiplexing_variables) free(mysql_thread___keep_multiplexing_variables);
mysql_thread___keep_multiplexing_variables=GloMTH->get_variable_string((char *)"keep_multiplexing_variables");
mysql_thread___server_capabilities=GloMTH->get_variable_uint16((char *)"server_capabilities");
mysql_thread___default_charset=GloMTH->get_variable_uint8((char *)"default_charset");
mysql_thread___poll_timeout=GloMTH->get_variable_int((char *)"poll_timeout");
Expand Down

0 comments on commit adb1614

Please sign in to comment.