Fixed minor leaks happening when an old highscore file is read (#683).

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12081 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-11-25 23:51:42 +00:00
parent cd8948902a
commit bd3d8cf2a3

View File

@ -85,7 +85,10 @@ void HighscoreManager::loadHighscores()
try
{
if(!root || root->getName()!="highscores")
{
if(root) delete root;
throw std::runtime_error("No 'highscore' node found.");
}
// check file version
int v;
@ -100,6 +103,7 @@ void HighscoreManager::loadHighscores()
// since we haven't had the chance to load the current scores yet,
// calling Save() now will generate an empty file with the right format.
saveHighscores();
delete root;
return;
}