Skip to content

Commit

Permalink
closes handle after use
Browse files Browse the repository at this point in the history
  • Loading branch information
Ameer Ayoub committed Jun 10, 2015
1 parent b276594 commit 3868a37
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions codesearch/index/mmap_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ func mmapFile(f *os.File) mmapData {
if err != nil {
log.Fatalf("CreateFileMapping %s: %v", f.Name(), err)
}
defer syscall.CloseHandle(syscall.Handle(h))

addr, err := syscall.MapViewOfFile(h, syscall.FILE_MAP_READ, 0, 0, 0)
if err != nil {
log.Fatalf("MapViewOfFile %s: %v", f.Name(), err)
}

data := (*[1 << 30]byte)(unsafe.Pointer(addr))
return mmapData{f, data[:size], data[:]}
}
Expand Down

0 comments on commit 3868a37

Please sign in to comment.