diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 6b16e3f272..8fca52979a 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -961,7 +961,7 @@ bool MySQL_Session::handler_again___verify_backend_sql_mode() { bool MySQL_Session::handler_again___verify_backend_time_zone() { if (mybe->server_myds->myconn->options.time_zone_int==0) { // it is the first time we use this backend. Set time_zone to default - if (mybe->server_myds->myconn->options.time_zone==NULL) { + if (mybe->server_myds->myconn->options.time_zone) { free(mybe->server_myds->myconn->options.time_zone); mybe->server_myds->myconn->options.time_zone=NULL; } diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index c66b1357fc..02950d5f9e 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -1665,6 +1665,11 @@ void MySQL_Connection::reset() { free(options.sql_mode); options.sql_mode = NULL; } + options.time_zone_int = 0; + if (options.time_zone) { + free(options.time_zone); + options.time_zone = NULL; + } } delete local_stmts; #ifndef PROXYSQL_STMT_V14