Skip to content

Commit 281db8e

Browse files
authored
Fix Windows .alwaysMapped deallocator (#1147)
1 parent d963e0b commit 281db8e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/FoundationEssentials/Data/Data+Reading.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ internal func readBytesFromFile(path inPath: PathOrURL, reportProgress: Bool, ma
268268
let szMapSize: UInt64 = min(UInt64(maxLength ?? Int.max), szFileSize)
269269
let pData: UnsafeMutableRawPointer =
270270
MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, SIZE_T(szMapSize))
271-
return ReadBytesResult(bytes: pData, length: Int(szMapSize), deallocator: .custom({ hMapping, _ in
272-
guard UnmapViewOfFile(hMapping) else {
271+
return ReadBytesResult(bytes: pData, length: Int(szMapSize), deallocator: .custom({ pData, _ in
272+
guard UnmapViewOfFile(pData) else {
273273
fatalError("UnmapViewOfFile")
274274
}
275275
guard CloseHandle(hMapping) else {

0 commit comments

Comments
 (0)