diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2017-08-23 23:05:29 +0200 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2017-08-23 23:05:29 +0200 |
| commit | 52f26d462ecd5fd4443e3ae8fbcc0ac8debc1748 (patch) | |
| tree | 2184c0c52cb4da4222871c6a3f7408390e8aa054 /Source/Core | |
| parent | 4ee85a3e076f8f5569809542b8d8a8869b9b47f9 (diff) | |
WiimoteReal: Fix device handles not being closed
fail.
I have no idea how this didn't cause issues for more people.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HW/WiimoteReal/IOWin.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp index 86e8a8c100..4701fdcef6 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp @@ -25,6 +25,7 @@ #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" +#include "Common/ScopeGuard.h" #include "Common/Thread.h" #include "Core/HW/WiimoteCommon/WiimoteConstants.h" #include "Core/HW/WiimoteReal/IOWin.h" @@ -366,6 +367,8 @@ static bool IsWiimote(const std::basic_string<TCHAR>& device_path, WinWriteMetho if (dev_handle == INVALID_HANDLE_VALUE) return false; + Common::ScopeGuard handle_guard{[&dev_handle] { CloseHandle(dev_handle); }}; + u8 buf[MAX_PAYLOAD]; u8 const req_status_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REQUEST_STATUS, 0}; int invalid_report_count = 0; |
