diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index fa4b93b..739f0ef 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -1273,15 +1273,15 @@ LatchDebug::shutdown() mutex_free(&rw_lock_debug_mutex); + ut_a(s_initialized); + + s_initialized = false; + if (instance() == NULL) { return; } - ut_a(s_initialized); - - s_initialized = false; - UT_DELETE(s_instance); LatchDebug::s_instance = NULL; diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc index db74c9c..900acb3 100644 --- a/storage/perfschema/unittest/pfs_instr-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc @@ -300,6 +300,9 @@ void test_oom() thread= psi->new_thread(thread_key_1, NULL, 0); ok(thread == NULL, "oom (per thread wait)"); cleanup_instruments(); + cleanup_file_class(); + cleanup_sync_class(); + cleanup_thread_class(); /* Thread waits history sizing. */ memset(¶m, 0, sizeof(param)); @@ -310,6 +313,7 @@ void test_oom() thread= psi->new_thread(thread_key_1, NULL, 0); ok(thread == NULL, "oom (thread waits history sizing)"); cleanup_instruments(); + cleanup_thread_class(); /* Per thread stages. */ memset(¶m, 0, sizeof(param)); @@ -320,6 +324,7 @@ void test_oom() ok(thread == NULL, "oom (per thread stages)"); cleanup_instruments(); cleanup_stage_class(); + cleanup_thread_class(); /* Thread stages history sizing. */ memset(¶m, 0, sizeof(param)); @@ -329,6 +334,7 @@ void test_oom() thread= psi->new_thread(thread_key_1, NULL, 0); ok(thread == NULL, "oom (thread stages history sizing)"); cleanup_instruments(); + cleanup_thread_class(); /* Per thread statements. */ memset(¶m, 0, sizeof(param)); @@ -340,6 +346,8 @@ void test_oom() ok(thread == NULL, "oom (per thread statements)"); cleanup_instruments(); cleanup_statement_class(); + cleanup_stage_class(); + cleanup_thread_class(); /* Thread statements history sizing. */ memset(¶m, 0, sizeof(param)); @@ -349,6 +357,7 @@ void test_oom() thread= psi->new_thread(thread_key_1, NULL, 0); ok(thread == NULL, "oom (thread statements history sizing)"); cleanup_instruments(); + cleanup_thread_class(); /* Per thread transactions. */ memset(¶m, 0, sizeof(param)); @@ -359,6 +368,7 @@ void test_oom() ok(thread == NULL, "oom (per thread transactions)"); transaction_class_max= 0; cleanup_instruments(); + cleanup_thread_class(); /* Thread transactions history sizing. */ memset(¶m, 0, sizeof(param)); diff --git a/unittest/gunit/innodb/mem0mem-t.cc b/unittest/gunit/innodb/mem0mem-t.cc index 8481741..d4f827c 100644 --- a/unittest/gunit/innodb/mem0mem-t.cc +++ b/unittest/gunit/innodb/mem0mem-t.cc @@ -43,6 +43,15 @@ protected: innodb_inited = true; } } + + virtual void + TearDown() + { + if (innodb_inited) { + sync_check_close(); + innodb_inited = false; + } + } }; /* test mem_heap_is_top() */ diff --git a/unittest/gunit/innodb/ut0new-t.cc b/unittest/gunit/innodb/ut0new-t.cc index 79b61c9..7e2f60b 100644 --- a/unittest/gunit/innodb/ut0new-t.cc +++ b/unittest/gunit/innodb/ut0new-t.cc @@ -194,8 +194,10 @@ TEST(ut0new, edgecases) #ifdef UNIV_PFS_MEMORY ret = alloc2.allocate(16); ASSERT_TRUE(ret != NULL); - ret = alloc2.reallocate(ret, too_many_elements, __FILE__); - EXPECT_EQ(NULL, ret); + void* ret2 = alloc2.reallocate(static_cast(ret), + too_many_elements, __FILE__); + EXPECT_EQ(NULL, ret2); + alloc2.deallocate(static_cast(ret)); #endif /* UNIV_PFS_MEMORY */ bool threw = false; diff --git a/unittest/gunit/keyring/buffered_file_io-t.cc b/unittest/gunit/keyring/buffered_file_io-t.cc index a18d4cd..ca03913 100644 --- a/unittest/gunit/keyring/buffered_file_io-t.cc +++ b/unittest/gunit/keyring/buffered_file_io-t.cc @@ -113,6 +113,7 @@ namespace keyring_buffered_file_io_unittest buffered_io_2->close(); delete buffered_io_2; + delete empty_key; remove(file_name.c_str()); } @@ -153,6 +154,7 @@ namespace keyring_buffered_file_io_unittest EXPECT_EQ(empty_key_1_data_size, sample_key_data1.length()+1); retVal= memcmp(empty_key_1_data, sample_key_data1.c_str(), empty_key_1_data_size); EXPECT_EQ(retVal, 0); + delete empty_key_1; IKey *empty_key_2= NULL; retVal= *buffered_io_2 >> &empty_key_2; @@ -166,6 +168,7 @@ namespace keyring_buffered_file_io_unittest EXPECT_EQ(empty_key_2_data_size, sample_key_data2.length()+1); retVal= memcmp(empty_key_2_data, sample_key_data2.c_str(), empty_key_2_data_size); EXPECT_EQ(retVal, 0); + delete empty_key_2; buffered_io_2->close(); diff --git a/unittest/gunit/keyring/keys_container-t.cc b/unittest/gunit/keyring/keys_container-t.cc index acad112..344bc3a 100644 --- a/unittest/gunit/keyring/keys_container-t.cc +++ b/unittest/gunit/keyring/keys_container-t.cc @@ -668,7 +668,13 @@ namespace keyring__keys_container_unittest std::string invalid_key_type("ZZZ"); (*key)->set_key_type(&invalid_key_type); } - return operator_in(key); + my_bool result= operator_in(key); + if (!result) + { + delete *key; + *key= NULL; + } + return result; } int load_key_from_buffer_on_call_number;