summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-06-05 15:20:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-05 20:55:08 +0300
commitefa8c534e3721b20d03f9fb3fe6c3423b1caca26 (patch)
tree9e4261af2e49468deac2672cb7310a14f518a53e
parenta74acce876c98c71e46b75f3a6487881fe056aed (diff)
downloadmariadb-git-bb-10.2.32-22529-22456.tar.gz
MDEV-22646: Fix a memory leakbb-10.2.32-22529-22456
btr_search_sys_free(): Free btr_search_sys->hash_tables. The leak was introduced in commit ad2bf1129cfa85c00072b46e0355fe14bf69ee54.
-rw-r--r--storage/innobase/btr/btr0sea.cc34
1 files changed, 22 insertions, 12 deletions
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index b4d4845b962..491a3e375d3 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -203,23 +203,33 @@ btr_search_sys_create(ulint hash_size)
}
/** Frees the adaptive search system at a database shutdown. */
-void
-btr_search_sys_free()
+void btr_search_sys_free()
{
- ut_ad(btr_search_sys != NULL && btr_search_latches != NULL);
+ ut_ad(btr_search_sys);
+ ut_ad(btr_search_latches);
- ut_free(btr_search_sys);
- btr_search_sys = NULL;
+ if (btr_search_sys->hash_tables)
+ {
+ for (ulint i= 0; i < btr_ahi_parts; ++i)
+ {
+ mem_heap_free(btr_search_sys->hash_tables[i]->heap);
+ hash_table_free(btr_search_sys->hash_tables[i]);
+ }
+ ut_free(btr_search_sys->hash_tables);
+ }
- /* Free all latches. */
- for (ulint i = 0; i < btr_ahi_parts; ++i) {
+ ut_free(btr_search_sys);
+ btr_search_sys= NULL;
- rw_lock_free(btr_search_latches[i]);
- ut_free(btr_search_latches[i]);
- }
+ /* Free all latches. */
+ for (ulint i= 0; i < btr_ahi_parts; ++i)
+ {
+ rw_lock_free(btr_search_latches[i]);
+ ut_free(btr_search_latches[i]);
+ }
- ut_free(btr_search_latches);
- btr_search_latches = NULL;
+ ut_free(btr_search_latches);
+ btr_search_latches= NULL;
}
/** Set index->ref_count = 0 on all indexes of a table.