summaryrefslogtreecommitdiff
path: root/sql-common/client.c
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2009-06-23 14:00:24 +0200
committerunknown <knielsen@knielsen-hq.org>2009-06-23 14:00:24 +0200
commite84748406cac825127279a16482756539267ec17 (patch)
treeb2d0471dcbf0dd79682803579827e824a2b211a4 /sql-common/client.c
parent7c5e321bb8a4ac0a1683447434a5cfe06452a0f9 (diff)
downloadmariadb-git-e84748406cac825127279a16482756539267ec17.tar.gz
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.
Diffstat (limited to 'sql-common/client.c')
-rw-r--r--sql-common/client.c5
1 files changed, 5 insertions, 0 deletions
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);