mirror of
https://github.com/vimpunk/mio.git
synced 2025-12-06 16:57:01 +08:00
Fix not releasing file handle on unsuccessful mapping on win32
This commit is contained in:
parent
76251b8dde
commit
b296e2d40f
@ -183,6 +183,8 @@ inline mmap_context memory_map(const file_handle_type file_handle, const int64_t
|
||||
length_to_map));
|
||||
if(mapping_start == nullptr)
|
||||
{
|
||||
// Close file handle if mapping it failed.
|
||||
::CloseHandle(file_mapping_handle);
|
||||
error = detail::last_error();
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -925,6 +925,8 @@ inline mmap_context memory_map(const file_handle_type file_handle, const int64_t
|
||||
length_to_map));
|
||||
if(mapping_start == nullptr)
|
||||
{
|
||||
// Close file handle if mapping it failed.
|
||||
::CloseHandle(file_mapping_handle);
|
||||
error = detail::last_error();
|
||||
return {};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user