mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-25 00:10:49 -04:00
Avoid double free in SinowealthController destructor
* Non USE_HID_USAGE code path needs to avoid closing device twice
This commit is contained in:
@@ -30,7 +30,14 @@ SinowealthController::SinowealthController(hid_device* dev_data_handle, hid_devi
|
||||
SinowealthController::~SinowealthController()
|
||||
{
|
||||
hid_close(dev_data);
|
||||
hid_close(dev_cmd);
|
||||
/*---------------------------------------------------------------------*\
|
||||
| If the dev_cmd handle was passed in as the same device as dev_data |
|
||||
| then attempting to close it a second time will segfault |
|
||||
\*---------------------------------------------------------------------*/
|
||||
if(dev_cmd)
|
||||
{
|
||||
hid_close(dev_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
std::string SinowealthController::GetLocation()
|
||||
|
||||
Reference in New Issue
Block a user