void CClass::Add(enum MyEnum eMy,BSTR bstring) {
CComBSTR temp(bstring);
switch(eMy)
{
case e1:
m_List1.AddTail(temp.Copy()); //m_List1, m_List2, m_List3 are of type CList<BSTR, BSTR>
break;
case e2:
m_List2.AddTail(temp.Copy());
break;
case e3:
m_List3.AddTail(temp.Copy());
break;
default:
break;
}
}
I am kind of new in COM and MFC and I am not sure whether my piece of code will cause memory problem when I try to remove the element from CList in some other function using RemoveHead() . Can anyone tell me does my code would cause memory leak or memory corruption? Thanks in Advance!