diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index f33dfa3a1b8..9e7548a21ed 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1742,6 +1742,11 @@ DROP TABLE t1; # BUG#34788 - malformed federated connection url is not handled correctly - # crashes server ! # +# also tests +# +# BUG#35509 - Federated leaks memory when connecting to localhost/default +# port +# CREATE TABLE t1 (a INT) ENGINE=federated CONNECTION='mysql://@:://'; DROP TABLE t1; diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index a5e4714c53a..d414dc34f02 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -656,7 +656,7 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table, if (!share->port) { if (!share->hostname || strcmp(share->hostname, my_localhost) == 0) - share->socket= my_strdup(MYSQL_UNIX_ADDR, MYF(0)); + share->socket= (char*) MYSQL_UNIX_ADDR; else share->port= MYSQL_PORT; } @@ -1342,7 +1342,6 @@ static int free_share(FEDERATED_SHARE *share) { hash_delete(&federated_open_tables, (byte*) share); my_free((gptr) share->scheme, MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR)); thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); my_free((gptr) share, MYF(0));