d3dx9: Avoid closing invalid handles.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50373
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2020-12-21 22:44:00 +09:00 committed by Alexandre Julliard
parent 175a3649ba
commit e27a95e920
1 changed files with 4 additions and 2 deletions

View File

@ -134,8 +134,10 @@ HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length)
return S_OK;
error:
CloseHandle(hmapping);
CloseHandle(hfile);
if (hmapping)
CloseHandle(hmapping);
if (hfile != INVALID_HANDLE_VALUE)
CloseHandle(hfile);
return HRESULT_FROM_WIN32(GetLastError());
}