[Quickfix-developers] simple leak
Brought to you by:
orenmnero
From: Kenny S. <the...@ya...> - 2004-01-13 03:39:14
|
I found a pretty obvious memory leak in the FileStore code: cvs server: Diffing . Index: FileStore.cpp =================================================================== RCS file: /cvsroot/quickfix/quickfix/src/C++/FileStore.cpp,v retrieving revision 1.3 diff -u -r1.3 FileStore.cpp --- FileStore.cpp 19 May 2003 00:38:58 -0000 1.3 +++ FileStore.cpp 13 Jan 2004 03:26:44 -0000 @@ -242,7 +242,11 @@ if ( fseek( m_msgFile, offset.first, SEEK_SET ) ) throw IOException(); char* buffer = new char[ offset.second + 1 ]; fread( buffer, sizeof( char ), offset.second, m_msgFile ); - if ( ferror( m_msgFile ) ) throw IOException(); + if ( ferror( m_msgFile ) ) + { + delete [] buffer; + throw IOException(); + } buffer[ offset.second ] = 0; msg = buffer; delete [] buffer; enjoy, -Kenny __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus |