Fix not releasing file handle on unsuccessful mapping on win32

This commit is contained in:
mandreyel 2019-12-27 18:25:47 +01:00
parent 76251b8dde
commit b296e2d40f
2 changed files with 16 additions and 12 deletions

View File

@ -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 {};
}

View File

@ -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 {};
}