MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:November 20 2008 10:08am
Subject:bzr commit into mysql-5.0-bugteam branch (ramil:2719) Bug#40875
View as plain text  
#At file:///home/ram/mysql/b40875.5.0-bugteam/

 2719 Ramil Kalimullin	2008-11-20
      Fix for bug#40875: Memory leak in FEDERATED handler
      
      Problem: memory leak occurs when we open a federated table
      that has its share in the hash.
      
      Fix: free not used memory.
      
      Note: the fix should NOT be merged to 5.1 (the code changed).
modified:
  sql/ha_federated.cc

per-file messages:
  sql/ha_federated.cc
    Fix for bug#40875: Memory leak in FEDERATED handler
      - free memory (tmp_share.scheme) allocated in the parse_url()
    if it isn't used anymore.
=== modified file 'sql/ha_federated.cc'
--- a/sql/ha_federated.cc	2008-08-15 06:40:05 +0000
+++ b/sql/ha_federated.cc	2008-11-20 10:08:36 +0000
@@ -1320,6 +1320,14 @@ static FEDERATED_SHARE *get_share(const 
     thr_lock_init(&share->lock);
     pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
   }
+  else
+  {
+    /* 
+      Free tmp_share.scheme allocated in the parse_url()
+      as we found share in the hash and tmp_share isn't needed anymore. 
+    */
+    my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
+  }
   share->use_count++;
   pthread_mutex_unlock(&federated_mutex);
 

Thread
bzr commit into mysql-5.0-bugteam branch (ramil:2719) Bug#40875Ramil Kalimullin20 Nov