Fix memleaks caused by SetupDiGetClassDevs() (#9746)
To prevent leaks, object should be cleaned up by calling SetupDiDestroyDeviceInfoList() Refer to https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdevsw#remarks
This commit is contained in:
parent
d98909289a
commit
1ae0618dee
@ -382,6 +382,7 @@ int pci_count_devices(uint16_t vid, uint16_t pid)
|
||||
deviceCnt++;
|
||||
}
|
||||
}
|
||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||
return deviceCnt;
|
||||
}
|
||||
#endif // (defined(_WIN32) || defined(_WIN64))
|
||||
|
Loading…
Reference in New Issue
Block a user