This is likely basic but it's been a long while since I used this. I have seen examples like each of the following:
IErrorInfo *pError;
HRESULT hrError = ::GetErrorInfo(NULL, &pError);
//more code here
if (SUCCEEDED(hrError) && pError) {
//more code here
pError->Release();
}
and then elsewhere
IErrorInfo *pError;
HRESULT hrError = ::GetErrorInfo(NULL, &pError);
//more code here
if (SUCCEEDED(hrError) && pError) {
//more code here
}
pError->Release();
Which of these is the proper way to use the Release()
here? Does it matter; and if so why?