From 8a376ae237f108bdff96d15bfffd5231d1dd78df Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 14 May 2011 18:37:20 +0200 Subject: [PATCH] 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(), --- sql/sql_cache.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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);