内存泄露问题~~~
//附件处理。主要是用于传送邮件的附件~~
但是下面
if(!m_file.IsEmpty())
{
char filename[256];
char* szTemp;
wsprintf(filename,"%s",m_file);
FILE* hFile=fopen(filename,"a+");
//获得文件大小
DWORD FileSize=0;
char temp[2];
while(fread(temp,1,1,hFile))
{
FileSize++;
}
fseek(hFile,0,0);
//读取文件内容
szTemp=(char*)malloc(FileSize);
fread(szTemp,FileSize,1,hFile);
char* szBuffer=(char*)malloc(FileSize);
mySmtp.base64(szTemp,szBuffer);
free(szTemp);
char* temp1=(char*)malloc(FileSize+200);
strcpy(temp1,"\r\nContent-Type:application/octet-stream;Name=%s\r\n");
strcat(temp1,"Content-Disposition:attachment;FileName=%s\r\n");
strcat(temp1,"Content-Transfer-Encoding:Base64\r\n\r\n");
strcat(temp1,"%s\r\n\r\n");
char* body=(char*)malloc(FileSize+400);
char temp2[256];
strcpy(temp2,strtok(filename,"\\"));
strcpy(temp2,strtok(NULL,"\\"));
wsprintf(body,temp1,temp2,temp2,szBuffer);
strcat(sendinfo.msg,body);
free(temp1);
free(body);
}
这个不知道是什么地方出现问题了~~
请高手帮忙~~~