没delete你就return了,当然要泄露了

解决方案 »

  1.   

    if (m_File.Find(m_str1) > -1)
    {
    //泄漏
    return TRUE;
    }
    }
    else if (m_File.Find(m_str1) > -1 && m_File.Find(m_str2) > -1)
    {
    //泄漏
    return TRUE;
    }建议写成__try__finally
      

  2.   

    if (oFile.Open(m_ResultTitle,CFile::modeRead,&oEx)) // 以读文件方式 打开文件
    {int flag = 0 ;const int nLength = (int)oFile.GetLength(); / 获取文件的大小长度
    char* pszBuf = new char[nLength+2];
    ZeroMemory(pszBuf,nLength+1); // ZeroMemory没有返回值,在pszBuf,中填充nLength+1个字节0;
    oFile.Read(pszBuf,nLength);
    CString m_File=pszBuf;if(m_str2.IsEmpty())
    {
    if (m_File.Find(m_str1) > -1)
    {
    flag = 1 ;
    }
    }
    else if (m_File.Find(m_str1) > -1 && m_File.Find(m_str2) > -1)
    {
    flag = 1 ;
    }oFile.Close();
    delete [] pszBuf;if(flag == 1)
    return TRUE;}
      

  3.   

    if(flag == 1)
    return TRUE;直接 return flag ;更简洁