Всем привет!
Что-то голова не варит, видимо погода.
Код приведенный ниже выдает memory leaks!
umping objects ->
strcore.cpp(118) : {354} normal block at 0x007F2570, 26 bytes long.
Data: < > 01
00 00 00 0D
00 00 00 0D 00 00 00 D1 EE E5 E4
{353} normal block at 0x007F2690, 4 bytes long.
Data: <|% > 7C 25 7F 00
Помогите определить ГДЕ!!!
BOOL CWork::connect(void)
{
BOOL bResult = TRUE;
DWORD dwAccessType;
LPCTSTR lpProxyName = NULL;
LPCTSTR lpProxyPort = NULL;
CString *pMsg = new CString;
if((g_tDates.bProxyUse)&&(!g_tDates.sProxyIP.IsEmpty())
&&(!g_tDates.sProxyPort.IsEmpty()))
{
lpProxyName = g_tDates.sProxyIP.GetBuffer(10);
g_tDates.sProxyIP.ReleaseBuffer();
lpProxyPort = g_tDates.sProxyPort.GetBuffer(2);
g_tDates.sProxyPort.ReleaseBuffer();
dwAccessType = INTERNET_OPEN_TYPE_PROXY;
}
else if(!g_tDates.bProxyUse)
dwAccessType = INTERNET_OPEN_TYPE_PRECONFIG;
else
{
*pMsg = ("Íåâåðíî çàäàíû ïàðàìåòðû PROXY");
SendMessage(m_hWndMsg, WMU_DOWNLOADEXCEPTION, reinterpret_cast<WPARAM>(pMsg), 0);
bResult = FALSE;
goto EndCode;
}
try {
if((g_tDates.sLogin.IsEmpty())||(g_tDates.sPwd.IsEmpty()))
{
*pMsg = ("Èìÿ ïîëüçîâàòåëÿ è/èëè ïàðîëü íå îïðåäåëåíû");
SendMessage(m_hWndMsg, WMU_DOWNLOADEXCEPTION, reinterpret_cast<WPARAM>(pMsg), 0);
bResult = FALSE;
goto EndCode;
}
if(ConnectionState())
{
pSession = new CInternetSessionEx(AfxGetApp()->m_pszAppName, 1, dwAccessType, lpProxyName, lpProxyPort, INTERNET_FLAG_DONT_CACHE);
pSession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 500);
pSession->SetOption(INTERNET_OPTION_CONNECT_RETRIES, 2);
pSession->EnableStatusCallback();
pFtpConnection = pSession->GetFtpConnection(g_tDates.SERVER, g_tDates.sLogin, g_tDates.sPwd, INTERNET_DEFAULT_FTP_PORT);
}
else
{
*pMsg = ("Íåò ñîåäèíåíèÿ ñ Èíòåðíåò");
SendMessage(m_hWndMsg, WMU_DOWNLOADEXCEPTION, reinterpret_cast<WPARAM>(pMsg), 0);
bResult = FALSE;
}
}
catch (CInternetException* pEx) {
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
*pMsg = sz;
pEx->Delete();
disconnect();
bResult = FALSE;
SendMessage(m_hWndMsg, WMU_DOWNLOADEXCEPTION, reinterpret_cast<WPARAM>(pMsg), 0);
}
catch (...) {
disconnect();
*pMsg = ("FTP Update: unhandled exception. (OnConnect)");
SendMessage(m_hWndMsg, WMU_DOWNLOADEXCEPTION, reinterpret_cast<WPARAM>(pMsg), 0);
bResult = FALSE;
}
EndCode:
if(pMsg != NULL)
{
delete pMsg;
pMsg = NULL;
}
return bResult;