From e84748406cac825127279a16482756539267ec17 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 Jun 2009 14:00:24 +0200 Subject: 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. --- sql-common/client.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sql-common/client.c') diff --git a/sql-common/client.c b/sql-common/client.c index fcee0d80e16..eae3728020f 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1585,6 +1585,11 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , { 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); -- cgit v1.2.1