diff --git a/base_c/test/thread_specific_storage_test.cc b/base_c/test/thread_specific_storage_test.cc index 50e7b0c..ccd0819 100644 --- a/base_c/test/thread_specific_storage_test.cc +++ b/base_c/test/thread_specific_storage_test.cc @@ -50,7 +50,11 @@ void ThreadSpecificStorageTest::Test() { size_t rank = partest::TestSuite::GetCurrentThreadID(); void* value = embb_tss_get(&tss_); if (value == NULL) { - int status = embb_tss_set(&tss_, new size_t(rank)); + size_t * prank = new size_t(rank); + int status = embb_tss_set(&tss_, prank); + if (EMBB_SUCCESS != status) { + delete prank; + } PT_EXPECT_EQ(status, EMBB_SUCCESS); } else { size_t stored_rank = *static_cast(value);