~CComQIPtr
destructor takes care of everything. You don't need to release explicitly. If you however want to, e.g. to reuse the variable, you can do either of the two:
m_pMyInterface.Release();
m_pMyInterface = NULL;
(operator=
works withCComPtr
, might be ambiguous withCComQIPtr
)
NULL checking is not necessary, CComQIPtr::Release
method does it anyway.