From d0a1c805e924be5cb2f2077f7af0f73491017c8a Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 22 Aug 2016 18:23:10 +0200 Subject: [PATCH] cmd/syncthing: uintptr may not be stored in a variable Must do the whole uintptr(unsafe.Pointer(&whatever)) directly in the call to sycall.Call, as per https://golang.org/pkg/unsafe/. --- cmd/syncthing/memsize_windows.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/syncthing/memsize_windows.go b/cmd/syncthing/memsize_windows.go index a778f77e6..b993c0432 100644 --- a/cmd/syncthing/memsize_windows.go +++ b/cmd/syncthing/memsize_windows.go @@ -20,9 +20,8 @@ var ( func memorySize() (int64, error) { var memoryStatusEx [64]byte binary.LittleEndian.PutUint32(memoryStatusEx[:], 64) - p := uintptr(unsafe.Pointer(&memoryStatusEx[0])) - ret, _, callErr := syscall.Syscall(uintptr(globalMemoryStatusEx), 1, p, 0, 0) + ret, _, callErr := syscall.Syscall(uintptr(globalMemoryStatusEx), 1, uintptr(unsafe.Pointer(&memoryStatusEx[0])), 0, 0) if ret == 0 { return 0, callErr }