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 authored and GitHub committed 2022-01-19 23:54:59 +03:00
1 parent d98909289a
commit 1ae0618dee
1 file changed
+1
@@ -382,6 +382,7 @@ int pci_count_devices(uint16_t vid, uint16_t pid)
deviceCnt++;
}
}
SetupDiDestroyDeviceInfoList(hDevInfo);
return deviceCnt;
}
#endif // (defined(_WIN32) || defined(_WIN64))