The Release method deletes the object when its reference count is zero.
STDMETHODIMP_(ULONG) CAVIFileCF::Release()
{
if (!--m_refs)
{
delete this; // If O, delete this instance.
return 0;
}
return m_refs;
}