tsan: fix leak of shadow stacks

llvm-svn: 276103
This commit is contained in:
Dmitry Vyukov 2016-07-20 10:29:08 +00:00
parent e3b9ee0645
commit dcad913ab6
1 changed files with 6 additions and 0 deletions

View File

@ -125,6 +125,12 @@ void ThreadContext::OnStarted(void *arg) {
}
void ThreadContext::OnFinished() {
#ifdef SANITIZER_GO
internal_free(thr->shadow_stack);
thr->shadow_stack = nullptr;
thr->shadow_stack_pos = nullptr;
thr->shadow_stack_end = nullptr;
#endif
if (!detached) {
thr->fast_state.IncrementEpoch();
// Can't increment epoch w/o writing to the trace as well.