[PATCH] D21902: [compiler-rt] Fix TLS resource leaking in unittest
Etienne Bergeron via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 30 12:01:41 PDT 2016
etienneb created this revision.
etienneb added a reviewer: rnk.
etienneb added subscribers: chrisha, llvm-commits.
Herald added a subscriber: kubabrecka.
The thread specific key wasn't not released.
Running the unittest in loop will fail after 1024 iteraions.
```
./projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-i386-Test --gtest_filter=SanitizerCommon.PthreadDestructorIterations --gtest_repeat=2000 --gtest_break_on_failure
```
```
Repeating all tests (iteration 1023) . . .
Note: Google Test filter = SanitizerCommon.PthreadDestructorIterations
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from SanitizerCommon
[ RUN ] SanitizerCommon.PthreadDestructorIterations
/usr/local/google/home/etienneb/llvm/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cc:54: Failure
Value of: pthread_key_create(&key, &destructor)
Actual: 11
Expected: 0
Aborted (core dumped)
```
http://reviews.llvm.org/D21902
Files:
lib/sanitizer_common/tests/sanitizer_posix_test.cc
Index: lib/sanitizer_common/tests/sanitizer_posix_test.cc
===================================================================
--- lib/sanitizer_common/tests/sanitizer_posix_test.cc
+++ lib/sanitizer_common/tests/sanitizer_posix_test.cc
@@ -56,6 +56,7 @@
EXPECT_TRUE(destructor_executed);
SpawnThread(GetPthreadDestructorIterations() + 1);
EXPECT_FALSE(destructor_executed);
+ ASSERT_EQ(0, pthread_key_delete(&key);
}
TEST(SanitizerCommon, IsAccessibleMemoryRange) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21902.62396.patch
Type: text/x-patch
Size: 481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160630/811196a2/attachment.bin>
More information about the llvm-commits
mailing list