MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:March 25 2008 8:48am
Subject:bk commit into 5.0 tree (svoj:1.2600) BUG#35509
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of svoj.  When svoj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository

ChangeSet@stripped, 2008-03-25 12:47:57+04:00, svoj@stripped +2 -0
  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.

  mysql-test/t/federated.test@stripped, 2008-03-25 12:47:55+04:00, svoj@stripped +5 -0
    A test case for BUG#35509.

  sql/, 2008-03-25 12:47:55+04:00, svoj@stripped +1 -2
    When creating federated table we call parse_url() to check if connect
    string is correct. parse_url() may make a copy of unix socket path if
    port is not specified or 0 and host is not specified or 'localhost'.
    This copy is never freed.
    As there is no need to make a copy of unix socket path, let
    share->socket point to MYSQL_UNIX_ADDR directly.

diff -Nrup a/mysql-test/t/federated.test b/mysql-test/t/federated.test
--- a/mysql-test/t/federated.test	2008-03-20 19:07:16 +04:00
+++ b/mysql-test/t/federated.test	2008-03-25 12:47:55 +04:00
@@ -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://@:://';
diff -Nrup a/sql/ b/sql/
--- a/sql/	2008-03-20 19:07:16 +04:00
+++ b/sql/	2008-03-25 12:47:55 +04:00
@@ -656,7 +656,7 @@ static int parse_url(FEDERATED_SHARE *sh
   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;
       share->port= MYSQL_PORT;
@@ -1342,7 +1342,6 @@ static int free_share(FEDERATED_SHARE *s
     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));
     my_free((gptr) share, MYF(0));
bk commit into 5.0 tree (svoj:1.2600) BUG#35509Sergey Vojtovich25 Mar
  • Re: bk commit into 5.0 tree (svoj:1.2600) BUG#35509Ingo Strüwing25 Mar