|
-
February 19th, 2009, 10:43 PM
#1
Memory Leak
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|