[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2716)
#At lp:maria 2716 knielsen@knielsen-hq.org 2009-06-23 Fix memory leak in mysql_ssl_set() when called more than once. Fix sleep() synchronisation in innodb_information_schema test case. modified: mysql-test/t/innodb_information_schema.test sql-common/client.c per-file messages: 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. === modified file 'mysql-test/t/innodb_information_schema.test' --- a/mysql-test/t/innodb_information_schema.test 2009-06-09 13:19:13 +0000 +++ b/mysql-test/t/innodb_information_schema.test 2009-06-23 12:00:24 +0000 @@ -109,14 +109,19 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '3 -- send SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE; -# Give time to the above 2 queries to execute before continuing. -# Without this sleep it sometimes happens that the SELECT from innodb_locks +-- connection con_verify_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 # 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 --- connection con_verify_innodb_locks SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data; === modified file 'sql-common/client.c' --- a/sql-common/client.c 2009-04-25 10:05:32 +0000 +++ b/sql-common/client.c 2009-06-23 12:00:24 +0000 @@ -1585,6 +1585,11 @@ mysql_ssl_set(MYSQL *mysql __attribute__ { DBUG_ENTER("mysql_ssl_set"); #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_cert= strdup_if_not_null(cert); mysql->options.ssl_ca= strdup_if_not_null(ca);
participants (1)
-
knielsen@knielsen-hq.org