memory leaks
От: romstyop  
Дата: 11.02.04 08:38
Оценка:
Всем привет!
Что-то голова не варит, видимо погода.

Код приведенный ниже выдает 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 = ("&Iacute;&aring;&acirc;&aring;&eth;&iacute;&icirc; &ccedil;&agrave;&auml;&agrave;&iacute;&ucirc; &iuml;&agrave;&eth;&agrave;&igrave;&aring;&ograve;&eth;&ucirc; 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 = ("&Egrave;&igrave;&yuml; &iuml;&icirc;&euml;&uuml;&ccedil;&icirc;&acirc;&agrave;&ograve;&aring;&euml;&yuml; &egrave;/&egrave;&euml;&egrave; &iuml;&agrave;&eth;&icirc;&euml;&uuml; &iacute;&aring; &icirc;&iuml;&eth;&aring;&auml;&aring;&euml;&aring;&iacute;&ucirc;");
            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 = ("&Iacute;&aring;&ograve; &ntilde;&icirc;&aring;&auml;&egrave;&iacute;&aring;&iacute;&egrave;&yuml; &ntilde; &Egrave;&iacute;&ograve;&aring;&eth;&iacute;&aring;&ograve;");
            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;
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.