diff options
author | Etienne Bergeron <etienneb@google.com> | 2016-06-30 19:56:14 +0000 |
---|---|---|
committer | Etienne Bergeron <etienneb@google.com> | 2016-06-30 19:56:14 +0000 |
commit | fb4ba14b70de070b215677487af1d4ee3ba518b5 (patch) | |
tree | 24f65140838af5aabcbc4654d95ea4e6930a0251 /compiler-rt | |
parent | b386955adc9176c9c3049cbd21ae13bff7508112 (diff) | |
download | bcm5719-llvm-fb4ba14b70de070b215677487af1d4ee3ba518b5.tar.gz bcm5719-llvm-fb4ba14b70de070b215677487af1d4ee3ba518b5.zip |
[compiler-rt] Fix TLS resource leaking in unittest
Summary:
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)
```
Reviewers: rnk
Subscribers: kubabrecka, llvm-commits, chrisha
Differential Revision: http://reviews.llvm.org/D21902
llvm-svn: 274264
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cc index 03ca449d362..b7cca83622a 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cc @@ -56,6 +56,7 @@ TEST(SanitizerCommon, PthreadDestructorIterations) { EXPECT_TRUE(destructor_executed); SpawnThread(GetPthreadDestructorIterations() + 1); EXPECT_FALSE(destructor_executed); + ASSERT_EQ(0, pthread_key_delete(key)); } TEST(SanitizerCommon, IsAccessibleMemoryRange) { |