aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2022-09-07 13:35:24 +0200
committerGopher Robot <gobot@golang.org>2022-09-09 15:36:26 +0000
commit600db8a514600df0d3a11edc220ed7e2f51ca158 (patch)
tree20ad4e23d0b97efb759106d7e41c940d01117a88 /src
parent861885841de7b073130c04bee4eace896b0b050f (diff)
downloadgo-600db8a514600df0d3a11edc220ed7e2f51ca158.tar.xz
runtime/race: also unmap memory if TestNonGoMemory fails
Change-Id: I7ea150e4896fc9b2e3a6dbdd9a1c2b651e74b844 Reviewed-on: https://go-review.googlesource.com/c/go/+/428778 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/race/race_unix_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/race/race_unix_test.go b/src/runtime/race/race_unix_test.go
index 6cc0730589..3cf53b0187 100644
--- a/src/runtime/race/race_unix_test.go
+++ b/src/runtime/race/race_unix_test.go
@@ -19,11 +19,11 @@ func TestNonGoMemory(t *testing.T) {
if err != nil {
t.Fatalf("failed to mmap memory: %v", err)
}
+ defer syscall.Munmap(data)
p := (*uint32)(unsafe.Pointer(&data[0]))
atomic.AddUint32(p, 1)
(*p)++
if *p != 2 {
t.Fatalf("data[0] = %v, expect 2", *p)
}
- syscall.Munmap(data)
}