Module: wine Branch: master Commit: e27a95e92097a601baa9b0e9dd6fcc5013c863fa URL: https://source.winehq.org/git/wine.git/?a=commit;h=e27a95e92097a601baa9b0e9d...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Mon Dec 21 22:44:00 2020 +0900
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
---
dlls/d3dx9_36/util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/util.c b/dlls/d3dx9_36/util.c index 5be9083360a..39afe6740c0 100644 --- a/dlls/d3dx9_36/util.c +++ b/dlls/d3dx9_36/util.c @@ -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()); }