aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Posix/tsd_dtor_leak.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Posix/tsd_dtor_leak.cc')
-rw-r--r--test/asan/TestCases/Posix/tsd_dtor_leak.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/asan/TestCases/Posix/tsd_dtor_leak.cc b/test/asan/TestCases/Posix/tsd_dtor_leak.cc
index 32253afc8b25..6952245227b4 100644
--- a/test/asan/TestCases/Posix/tsd_dtor_leak.cc
+++ b/test/asan/TestCases/Posix/tsd_dtor_leak.cc
@@ -1,7 +1,7 @@
// Regression test for a leak in tsd:
// https://code.google.com/p/address-sanitizer/issues/detail?id=233
// RUN: %clangxx_asan -O1 %s -pthread -o %t
-// RUN: ASAN_OPTIONS=quarantine_size=1 %run %t
+// RUN: ASAN_OPTIONS=quarantine_size_mb=0 %run %t
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
@@ -25,15 +25,17 @@ void Dtor(void *tsd) {
int main() {
assert(0 == pthread_key_create(&tsd_key, Dtor));
- size_t old_heap_size = 0;
+ pthread_t t;
+ for (int i = 0; i < 3; i++) {
+ pthread_create(&t, 0, Thread, 0);
+ pthread_join(t, 0);
+ }
+ size_t old_heap_size = __sanitizer_get_heap_size();
for (int i = 0; i < 10; i++) {
- pthread_t t;
pthread_create(&t, 0, Thread, 0);
pthread_join(t, 0);
size_t new_heap_size = __sanitizer_get_heap_size();
fprintf(stderr, "heap size: new: %zd old: %zd\n", new_heap_size, old_heap_size);
- if (old_heap_size)
- assert(old_heap_size == new_heap_size);
- old_heap_size = new_heap_size;
+ assert(old_heap_size == new_heap_size);
}
}