From 001a3f78335ba4b10d89fe3dd75865f50bbed885 Mon Sep 17 00:00:00 2001 From: Marcus Winter Date: Thu, 11 Feb 2016 09:17:29 +0100 Subject: [PATCH] base_c: fixed memory leak in ThreadSpecificStorageTest --- base_c/test/thread_specific_storage_test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- libgit2 0.26.0