Commit 3677dd5c authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-22646: Fix a memory leak

btr_search_sys_free(): Free btr_search_sys->hash_tables.

The leak was introduced in commit ad2bf112.
parent 1828196f
...@@ -203,23 +203,33 @@ btr_search_sys_create(ulint hash_size) ...@@ -203,23 +203,33 @@ btr_search_sys_create(ulint hash_size)
} }
/** Frees the adaptive search system at a database shutdown. */ /** Frees the adaptive search system at a database shutdown. */
void void btr_search_sys_free()
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); if (btr_search_sys->hash_tables)
btr_search_sys = NULL; {
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. */ ut_free(btr_search_sys);
for (ulint i = 0; i < btr_ahi_parts; ++i) { btr_search_sys= NULL;
rw_lock_free(btr_search_latches[i]); /* Free all latches. */
ut_free(btr_search_latches[i]); 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); ut_free(btr_search_latches);
btr_search_latches = NULL; btr_search_latches= NULL;
} }
/** Set index->ref_count = 0 on all indexes of a table. /** Set index->ref_count = 0 on all indexes of a table.
......
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