• unknown's avatar
    BUG#35509 - Federated leaks memory when connecting to · 5ad505dd
    unknown authored
                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:
      A test case for BUG#35509.
    sql/ha_federated.cc:
      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.
    5ad505dd
ha_federated.cc 86.8 KB