Fix memory leak.
Before: 51057 leaks for 850704 total leaked bytes. After: 21258 leaks for 359284 total leaked bytes. Both of these were taken right after the songs finish loading and the first screen is shown.
This commit is contained in:
@@ -173,14 +173,14 @@ void _SetString( char* psz, char* end, CString* ps, bool trim = false, int escap
|
|||||||
{
|
{
|
||||||
len = _tcselen( escape, psz, end );
|
len = _tcselen( escape, psz, end );
|
||||||
// char* pss = ps->GetBufferSetLength( len );
|
// char* pss = ps->GetBufferSetLength( len );
|
||||||
char* szTemp = new char[len];
|
char szTemp[len];
|
||||||
strlen( szTemp, escape, psz, end );
|
strlen( szTemp, escape, psz, end );
|
||||||
*ps = szTemp;
|
*ps = szTemp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// char* pss = ps->GetBufferSetLength(len + 1 );
|
// char* pss = ps->GetBufferSetLength(len + 1 );
|
||||||
char* szTemp = new char[len+1];
|
char szTemp[len+1];
|
||||||
memcpy( szTemp, psz, len );
|
memcpy( szTemp, psz, len );
|
||||||
szTemp[len] = '\0';
|
szTemp[len] = '\0';
|
||||||
*ps = szTemp;
|
*ps = szTemp;
|
||||||
|
|||||||
Reference in New Issue
Block a user