C4703 - Potentially uninitialized local variable (Looks like false positive - can't find positive path)

  • Thread starter Thread starter [MSFT] Stratcat
  • Start date Start date
M

[MSFT] Stratcat

Guest
Okay, here's something that has me scratching my head. Typically uninitialized variable usage is easy to find however I've not found this one yet. Can anyone else find it?

(some code reduced)


IEnumWbemClassObject *pIEnumerator;
HRESULT hr = E_FAIL;
DWORD dwRes;

if( (dwRes=Connect()) == ERROR_SUCCESS )
{
if( (dwRes=CreateQuery(&bstrQuery)) == ERROR_SUCCESS )
{
hr = m_pIService->ExecQuery( bstr_t(L"WQL"),
bstrQuery,
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pIEnumerator );
SysFreeString( bstrQuery );
}
}


while( dwRes == ERROR_SUCCESS && hr == WBEM_S_NO_ERROR )
{
IWbemClassObject *pIClass;
SAFEARRAY *pNamesArray;
DWORD dwBatchSize;

// BELOW: C4703 on pIEnumerator not initialized. What's the uninit path?
if( FAILED(hr=pIEnumerator->Next(MAX_WMI_QUERY_TIMEOUT,
m_dwMaxBatchSize,
&pIClass, &dwBatchSize)) )
{
continue;
}
[ ... ]
}

Continue reading...
 
Back
Top