Ahoj, mam nasledujici kod z FileZilla Serveru, ve kterem byl vytvoren novy pointer "pMsg" tento pointer byl predan jako parametr funkci "PostMessage(...)", kdyz funkce neni spravne provedena variable "BOOL res" bude nula a tudis vytvorenou alokaci pro "pMsg" vymazu, pokud ale funkce PostMessage bude provedena spravne, neni v kodu implementovana zadna dealokace pro pMsg. Provadi tedy dealokaci sama funkce PostMessage()?
if (m_pFirstLayer)
{
CAsyncSocketExLayer::t_LayerNotifyMsg *pMsg = new CAsyncSocketExLayer::t_LayerNotifyMsg;
pMsg->hSocket = m_SocketData.hSocket;
pMsg->lEvent=lEvent%0xFFFF;
pMsg->pLayer=0;
BOOL res=PostMessage(GetHelperWindowHandle(), WM_USER, (WPARAM)m_SocketData.nSocketIndex, (LPARAM)pMsg);
if (!res)
delete pMsg;
return res;
}
Funkce z MSDN library
Zpět na “Programování a tvorba webu”
Kdo je online
Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 5 hostů