Avoid double free in SinowealthController destructor
* Non USE_HID_USAGE code path needs to avoid closing device twice
This commit is contained in:
parent
dd91984b70
commit
31b752feed
1 changed files with 8 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue