Hi,

I have not been able to find out how to get around the memory leak. I know what part of the code is giving me problems, but have yet found a way to resolve it.

Here is the code in question:

#include <sys\types.h>
#include <sys\stat.h>
__int64 FileSize64( const char * szFileName )
{
struct __stat64 fileStat;
int err = _stat64( szFileName, &fileStat );
if (0 != err) return 0;
return fileStat.st_size;
}



char *string = new char[szTemp.GetLength() + 1];
string = (char*)szTemp.GetBuffer(szTemp.GetLength() + 1);
szTemp.ReleaseBuffer();
wcstombs(string, szTemp, szTemp.GetLength() + 1);
m_nFileSize = FileSize64(string);

*** Blows up right here ***
delete [] string;

Everything I have tried has not worked. What in the world am I doing wrong and how can I fix it?

TIA