mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
BUG#35509 - Federated leaks memory when connecting to
localhost/default port When creating federated table that points to unspecified host or localhost on unspecified port or port is 0, small memory leak occurs. This happens because we make a copy of unix socket path, which is never freed. With this fix we do not make a copy of unix socket path, instead share->socket points to MYSQL_UNIX_ADDR constant directly. This fix is covered by a test case for BUG34788. Affects 5.0 only.
This commit is contained in:
parent
2b552aae50
commit
f064cd84d5
2 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue