Fixed huge memory leak in when contructing the gamelist.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@420 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-05-11 23:06:52 +00:00
parent 468f680725
commit bc40ce9ad4
2 changed files with 10 additions and 4 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GameList.cxx,v 1.2 2005-05-11 01:44:39 stephena Exp $ // $Id: GameList.cxx,v 1.3 2005-05-11 23:06:52 stephena Exp $
// //
// Based on code from KStella - Stella frontend // Based on code from KStella - Stella frontend
// Copyright (C) 2003-2005 Stephen Anthony // Copyright (C) 2003-2005 Stephen Anthony
@ -47,6 +47,9 @@ void GameList::appendGame(const string& rom, const string& name, const string& n
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameList::sortByName() void GameList::sortByName()
{ {
if(myArray.size() <= 1)
return;
// Simple selection sort // Simple selection sort
for(uInt32 i = 0; i < myArray.size()-1; i++) for(uInt32 i = 0; i < myArray.size()-1; i++)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: LauncherDialog.cxx,v 1.8 2005-05-11 19:36:00 stephena Exp $ // $Id: LauncherDialog.cxx,v 1.9 2005-05-11 23:06:52 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -174,7 +174,7 @@ void LauncherDialog::updateListing(bool fullReload)
else // we have no other choice else // we have no other choice
loadListFromDisk(); loadListFromDisk();
*/ */
// Start with empty lists // Start with empty list
myGameList->clear(); myGameList->clear();
string cacheFile = instance()->cacheFile(); string cacheFile = instance()->cacheFile();
@ -301,7 +301,10 @@ string LauncherDialog::MD5FromFile(const string& path)
uInt32 size = in.gcount(); uInt32 size = in.gcount();
in.close(); in.close();
return MD5(image, size); string md5 = MD5(image, size);
delete[] image;
return md5;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -