Commit b93c93d8 authored by unknown's avatar unknown

Fix memory leak in mysql_ssl_set() when called more than once.

Fix sleep() synchronisation in innodb_information_schema test case.

mysql-test/t/innodb_information_schema.test:
  Using sleep for synchronisation does not work!!!
  Replace by looping until the required condition is met.
sql-common/client.c:
  mysql_ssl_set() did not free old pointers before overwriting with new ones (happens when
  mysql_ssl_set() is called twice without calling mysql_close() in-between).
  
  This sometimes caused memory leaks in the slave depending on exact timing of
  master/slave shutdown.
  
  Fixed by freeing old pointers before installing new ones in mysql_ssl_set(), just like
  mysql_options() does.
parent c0342ce4
...@@ -109,14 +109,19 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE; ...@@ -109,14 +109,19 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE;
-- send -- send
SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE; SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
# Give time to the above 2 queries to execute before continuing. -- connection con_verify_innodb_locks
# Without this sleep it sometimes happens that the SELECT from innodb_locks
# Loop, giving time for the above 2 queries to execute before continuing.
# Without this, it sometimes happens that the SELECT FROM innodb_locks
# executes before some of them, resulting in less than expected number # executes before some of them, resulting in less than expected number
# of rows being selected from innodb_locks. # of rows being selected from innodb_locks.
-- sleep 0.1 SET @counter := 0;
while (`SELECT (@counter := @counter + 1) <= 50 AND COUNT(*) != 14 FROM INFORMATION_SCHEMA.INNODB_LOCKS`)
{
sleep 0.1;
}
-- enable_result_log -- enable_result_log
-- connection con_verify_innodb_locks
SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data; FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
......
...@@ -1585,6 +1585,11 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , ...@@ -1585,6 +1585,11 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
{ {
DBUG_ENTER("mysql_ssl_set"); DBUG_ENTER("mysql_ssl_set");
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
mysql->options.ssl_key= strdup_if_not_null(key); mysql->options.ssl_key= strdup_if_not_null(key);
mysql->options.ssl_cert= strdup_if_not_null(cert); mysql->options.ssl_cert= strdup_if_not_null(cert);
mysql->options.ssl_ca= strdup_if_not_null(ca); mysql->options.ssl_ca= strdup_if_not_null(ca);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment