Commit 688fb630 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-23526 InnoDB leaks memory for some static objects

A leak of the contents of fil_system.ssd that was introduced in
commit 10dd290b (MDEV-17380)
was caught by implementing SAFEMALLOC instrumentation of operator new.
I did not try to find out how to make AddressSanitizer or Valgrind
detect it.

fil_system_t::close(): Clear fil_system.ssd.

The leak was identified and a fix suggested by Michael Widenius
and Vicențiu Ciorbaru.
parent 2643249d
......@@ -1610,22 +1610,28 @@ void fil_system_t::create(ulint hash_size)
void fil_system_t::close()
{
ut_ad(this == &fil_system);
ut_a(!UT_LIST_GET_LEN(LRU));
ut_a(unflushed_spaces.empty());
ut_a(!UT_LIST_GET_LEN(space_list));
ut_ad(!sys_space);
ut_ad(!temp_space);
if (is_initialised()) {
m_initialised = false;
hash_table_free(spaces);
spaces = NULL;
mutex_free(&mutex);
fil_space_crypt_cleanup();
}
ut_ad(this == &fil_system);
ut_a(!UT_LIST_GET_LEN(LRU));
ut_a(unflushed_spaces.empty());
ut_a(!UT_LIST_GET_LEN(space_list));
ut_ad(!sys_space);
ut_ad(!temp_space);
if (is_initialised())
{
m_initialised= false;
hash_table_free(spaces);
spaces = nullptr;
mutex_free(&mutex);
fil_space_crypt_cleanup();
}
ut_ad(!spaces);
ut_ad(!spaces);
#ifdef UNIV_LINUX
ssd.clear();
ssd.shrink_to_fit();
#endif /* UNIV_LINUX */
}
/*******************************************************************//**
......
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