If Intel metrics device version check fails, don't call invalid function

This commit is contained in:
baldurk
2018-12-03 12:13:19 +00:00
parent b564555538
commit 3233afd390
+10 -4
View File
@@ -45,14 +45,17 @@ IntelCounters::~IntelCounters()
{
SAFE_RELEASE(m_deviceContext);
if(CloseMetricsDevice)
{
if(CloseMetricsDevice && m_metricsDevice)
CloseMetricsDevice(m_metricsDevice);
m_metricsDevice = NULL;
}
m_metricsDevice = NULL;
if(m_MDLibraryHandle)
FreeLibrary(m_MDLibraryHandle);
m_MDLibraryHandle = (HMODULE)0;
OpenMetricsDevice = NULL;
CloseMetricsDevice = NULL;
}
void IntelCounters::Load()
@@ -95,8 +98,11 @@ bool IntelCounters::Init(void *pContext)
{
CloseMetricsDevice(m_metricsDevice);
FreeLibrary(m_MDLibraryHandle);
m_metricsDevice = NULL;
m_MDLibraryHandle = (HMODULE)0;
OpenMetricsDevice = NULL;
CloseMetricsDevice = NULL;
return false;
}