From fc67e8e7aaab13d10e247ebae4b3d19b2e11189c Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Wed, 9 Oct 2024 15:12:54 +0500 Subject: [PATCH] Fixed memory leak in PgSQL_Protocol --- lib/PgSQL_Protocol.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/PgSQL_Protocol.cpp b/lib/PgSQL_Protocol.cpp index 1a87ff8a4..b152a4b49 100644 --- a/lib/PgSQL_Protocol.cpp +++ b/lib/PgSQL_Protocol.cpp @@ -767,6 +767,7 @@ EXECUTION_STATE PgSQL_Protocol::process_handshake_response_packet(unsigned char* #endif // debug (*myds)->sess->default_hostgroup = default_hostgroup; //(*myds)->sess->default_schema = default_schema; // just the pointer is passed + if ((*myds)->sess->user_attributes) free((*myds)->sess->user_attributes); (*myds)->sess->user_attributes = attributes; // just the pointer is passed //(*myds)->sess->schema_locked = schema_locked; (*myds)->sess->transaction_persistent = transaction_persistent; @@ -794,6 +795,8 @@ EXECUTION_STATE PgSQL_Protocol::process_handshake_response_packet(unsigned char* password = l_strdup(mysql_thread___monitor_password); } } + + if (attributes) free(attributes); } if (password) {