Commit 001a3f78 by Marcus Winter

base_c: fixed memory leak in ThreadSpecificStorageTest

parent 334a11e8
...@@ -50,7 +50,11 @@ void ThreadSpecificStorageTest::Test() { ...@@ -50,7 +50,11 @@ void ThreadSpecificStorageTest::Test() {
size_t rank = partest::TestSuite::GetCurrentThreadID(); size_t rank = partest::TestSuite::GetCurrentThreadID();
void* value = embb_tss_get(&tss_); void* value = embb_tss_get(&tss_);
if (value == NULL) { 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); PT_EXPECT_EQ(status, EMBB_SUCCESS);
} else { } else {
size_t stored_rank = *static_cast<size_t*>(value); size_t stored_rank = *static_cast<size_t*>(value);
......
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 sign in to comment