Commit 240d0633 authored by Ramil Kalimullin's avatar Ramil Kalimullin

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).
parent 0001121c
...@@ -1320,6 +1320,14 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) ...@@ -1320,6 +1320,14 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
thr_lock_init(&share->lock); thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST); 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++; share->use_count++;
pthread_mutex_unlock(&federated_mutex); pthread_mutex_unlock(&federated_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment