mirror of
https://github.com/etcd-io/bbolt.git
synced 2025-05-31 11:42:30 +00:00
Close CreateFileMapping
handle after MapViewOfFile
failure
mmap-go does this, see 82d537b921
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
52d028ffe9
commit
4504feba82
@ -82,6 +82,8 @@ func mmap(db *DB, sz int) error {
|
|||||||
// Create the memory map.
|
// Create the memory map.
|
||||||
addr, errno := syscall.MapViewOfFile(h, syscall.FILE_MAP_READ, 0, 0, 0)
|
addr, errno := syscall.MapViewOfFile(h, syscall.FILE_MAP_READ, 0, 0, 0)
|
||||||
if addr == 0 {
|
if addr == 0 {
|
||||||
|
// Do our best and report error returned from MapViewOfFile.
|
||||||
|
_ = syscall.CloseHandle(h)
|
||||||
return os.NewSyscallError("MapViewOfFile", errno)
|
return os.NewSyscallError("MapViewOfFile", errno)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user