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:
Vitaliy Urusovskij 2022-01-19 23:54:59 +03:00 committed by GitHub
parent d98909289a
commit 1ae0618dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -382,6 +382,7 @@ int pci_count_devices(uint16_t vid, uint16_t pid)
deviceCnt++;
}
}
SetupDiDestroyDeviceInfoList(hDevInfo);
return deviceCnt;
}
#endif // (defined(_WIN32) || defined(_WIN64))