又出问题了。救命啊!

lovering 2000-10-26 04:33:00
现在我的程序终于能收qp编码的邮件了。
可是新问题出来了,不知道为什么不能删除一个数组。只能收到第一封信。
进行到delete []sbuf时出错
DAMAGE: after normal block (#68) at 0x00650089


附带源码如下,救命啊!!!!!
BOOL CPop3Connection::ReadReturnResponse(CPop3Message& message, DWORD dwSize)
{
//Must be connected to perform a "RETR"
ASSERT(m_bConnected);

//We need a flexible sized receiver buffer here
int nSize = dwSize + 100;
char* sBuf = new char[nSize];
if (!ReadResponse(sBuf, nSize, "\r\n\r\n"))
{
TRACE(_T("Error retrieving the RETR response"));
return FALSE;
}

//determine if the response is an error
if (strnicmp(sBuf,"+OK", 3) != 0)
{
SetLastError(WSAEPROTONOSUPPORT);
TRACE(_T("POP3 server did not respond correctly to the RETR response\n"));
delete []sBuf;
return FALSE;
}
else
{
//remove the first line which contains the +OK from the message
char* pszFirst = GetFirstCharInResponse(sBuf);
VERIFY(pszFirst);

//transfer the message contents to the message class
int nMessageSize = sBuf - pszFirst + strlen(sBuf);
message.m_pszMessage = new char[nMessageSize + 1];
memcpy(message.m_pszMessage, pszFirst, nMessageSize);
message.m_pszMessage[nMessageSize] = '\0';
}
delete []sBuf;
return TRUE;
..........

...全文
84 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧