Skip to content

Commit 600db8a

Browse files
tklausergopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 8618858 commit 600db8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/race/race_unix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ func TestNonGoMemory(t *testing.T) {
1919
if err != nil {
2020
t.Fatalf("failed to mmap memory: %v", err)
2121
}
22+
defer syscall.Munmap(data)
2223
p := (*uint32)(unsafe.Pointer(&data[0]))
2324
atomic.AddUint32(p, 1)
2425
(*p)++
2526
if *p != 2 {
2627
t.Fatalf("data[0] = %v, expect 2", *p)
2728
}
28-
syscall.Munmap(data)
2929
}

0 commit comments

Comments
 (0)