From f6572498a27ab7794fd53f14c1d9dbc535215d46 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 18 Sep 2002 20:22:24 +0000 Subject: [PATCH] fix small memleak +/* */s --- stepmania/src/MsdFile.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stepmania/src/MsdFile.cpp b/stepmania/src/MsdFile.cpp index 107ff30a33..4fd96f4232 100644 --- a/stepmania/src/MsdFile.cpp +++ b/stepmania/src/MsdFile.cpp @@ -39,17 +39,19 @@ bool MsdFile::ReadFile( CString sNewPath ) int iBufferSize = GetFileSize( hFile, NULL ) + 1000; // +1000 just in case CloseHandle( hFile ); - // allocate a string to hold the file - char* szFileString = new char[iBufferSize]; - char* szParams[MAX_VALUES][MAX_PARAMS_PER_VALUE]; - FILE* fp = fopen(sNewPath, "r"); if( fp == NULL ) return false; + // allocate a string to hold the file + char* szFileString = new char[iBufferSize]; + char* szParams[MAX_VALUES][MAX_PARAMS_PER_VALUE]; + int iBytesRead = fread( szFileString, 1, iBufferSize, fp ); ASSERT( iBufferSize > iBytesRead ); // why are these not always =? + /* because iBufferSize is the filesize+1000. why are we using Windows + * API calls for simple file access, anyway? XXX -glenn */ m_iNumValues = 0;