summaryrefslogtreecommitdiff
path: root/compiler-rt/lib/lsan/lsan_interceptors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/lsan/lsan_interceptors.cpp')
-rw-r--r--compiler-rt/lib/lsan/lsan_interceptors.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index 2a35572edfec..b7268163bb23 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -489,7 +489,9 @@ INTERCEPTOR(int, pthread_detach, void *thread) {
}
INTERCEPTOR(int, pthread_exit, void *retval) {
- GetThreadArgRetval().Finish(GetThreadSelf(), retval);
+ ThreadContextLsanBase *t = GetCurrentThread();
+ if (t && t->tid != kMainTid)
+ GetThreadArgRetval().Finish(GetThreadSelf(), retval);
return REAL(pthread_exit)(retval);
}