From: Tobias Klauser Date: Wed, 7 Sep 2022 11:35:24 +0000 (+0200) Subject: runtime/race: also unmap memory if TestNonGoMemory fails X-Git-Tag: go1.20rc1~1086 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=600db8a514600df0d3a11edc220ed7e2f51ca158;p=gostls13.git 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 Reviewed-by: Ian Lance Taylor Reviewed-by: Michael Knyszek Run-TryBot: Tobias Klauser TryBot-Result: Gopher Robot --- 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) }