summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2011-05-14 18:37:20 +0200
committerVladislav Vaintroub <wlad@montyprogram.com>2011-05-14 18:37:20 +0200
commit8a376ae237f108bdff96d15bfffd5231d1dd78df (patch)
tree39a06870ccaa16f3f72f93c917da70be99d9ac77
parent218c7665be6ca9c310ba1dd847b5ab88f70eeb33 (diff)
downloadmariadb-git-8a376ae237f108bdff96d15bfffd5231d1dd78df.tar.gz
LPBUG#782223 : Memory released by Query_cache::resize() or Query_cache::free() contains active rwlocks.
The bug was found by application verifier. Fixed by destroying locks prior to free(),
-rw-r--r--sql/sql_cache.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 81cc87723c5..f358d5537d2 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2253,6 +2253,18 @@ void Query_cache::free_cache()
{
DBUG_ENTER("Query_cache::free_cache");
+ /* Destroy locks */
+ Query_cache_block *block= queries_blocks;
+ if (block)
+ {
+ do
+ {
+ Query_cache_query *query= block->query();
+ my_rwlock_destroy(&query->lock);
+ block= block->next;
+ } while (block != queries_blocks);
+ }
+
my_free((uchar*) cache, MYF(MY_ALLOW_ZERO_PTR));
make_disabled();
hash_free(&queries);