diff --git a/include/PgSQL_Connection.h b/include/PgSQL_Connection.h index 82c8127c7..b54790524 100644 --- a/include/PgSQL_Connection.h +++ b/include/PgSQL_Connection.h @@ -348,10 +348,7 @@ class PgSQL_Connection_Placeholder { PgSQL_Connection_userinfo *userinfo; PgSQL_Data_Stream *myds; - struct { - char* hostname; - char* ip; - } connected_host_details; + /** * @brief Keeps tracks of the 'server_status'. Do not confuse with the 'server_status' from the * 'MYSQL' connection itself. This flag keeps track of the configured server status from the @@ -587,6 +584,11 @@ public: void reset(); + struct { + char* hostname; + char* ip; + } connected_host_details; + PgSQL_Variable variables[PGSQL_NAME_LAST_HIGH_WM]; uint32_t var_hash[PGSQL_NAME_LAST_HIGH_WM]; // for now we store possibly missing variables in the lower range diff --git a/lib/PgSQL_Connection.cpp b/lib/PgSQL_Connection.cpp index 0eefd907a..8d4eac7ab 100644 --- a/lib/PgSQL_Connection.cpp +++ b/lib/PgSQL_Connection.cpp @@ -324,7 +324,7 @@ PgSQL_Connection_Placeholder::PgSQL_Connection_Placeholder() { statuses.questions = 0; statuses.pgconnpoll_get = 0; statuses.pgconnpoll_put = 0; - memset(&connected_host_details, 0, sizeof(connected_host_details)); + }; PgSQL_Connection_Placeholder::~PgSQL_Connection_Placeholder() { @@ -369,14 +369,7 @@ PgSQL_Connection_Placeholder::~PgSQL_Connection_Placeholder() { options.session_track_gtids=NULL; } - if (connected_host_details.hostname) { - free(connected_host_details.hostname); - connected_host_details.hostname = NULL; - } - if (connected_host_details.ip) { - free(connected_host_details.ip); - connected_host_details.hostname = NULL; - } + }; bool PgSQL_Connection_Placeholder::set_autocommit(bool _ac) { @@ -648,6 +641,7 @@ PgSQL_Connection::PgSQL_Connection() { new_result = true; is_copy_out = false; reset_error(); + memset(&connected_host_details, 0, sizeof(connected_host_details)); } PgSQL_Connection::~PgSQL_Connection() {