//call this:
if (m_lpObject)
{
m_lpObject->Release();
m_lpObject = NULL;
}
for more that hwo to use InSertObject,see
HOWTO: Insert a Bitmap Into an RTF Document Using the RichEdit Control
The rich edit control automatically increments the reference count for the interfaces if it holds onto them, so the caller can safely release the interfaces if they are not needed.