summaryrefslogtreecommitdiff
path: root/lib/tsan/go/tsan_go.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tsan/go/tsan_go.cc')
-rw-r--r--lib/tsan/go/tsan_go.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tsan/go/tsan_go.cc b/lib/tsan/go/tsan_go.cc
index 77da9fe70..eca6cae4e 100644
--- a/lib/tsan/go/tsan_go.cc
+++ b/lib/tsan/go/tsan_go.cc
@@ -105,7 +105,7 @@ void __tsan_fini() {
thr->in_rtl++;
int res = Finalize(thr);
thr->in_rtl--;
- exit(res);
+ exit(res);
}
void __tsan_read(int goid, void *addr, void *pc) {
@@ -130,6 +130,8 @@ void __tsan_func_exit(int goid) {
void __tsan_malloc(int goid, void *p, uptr sz, void *pc) {
ThreadState *thr = goroutines[goid];
+ if (thr == 0) // probably before __tsan_init()
+ return;
thr->in_rtl++;
MemoryResetRange(thr, (uptr)pc, (uptr)p, sz);
MemoryAccessRange(thr, (uptr)pc, (uptr)p, sz, true);