Bugfix: if the highscore file is invalid, a double free happened.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12408 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
08c3c7487a
commit
1254dbfa9e
@ -87,6 +87,7 @@ void HighscoreManager::loadHighscores()
|
|||||||
if(!root || root->getName()!="highscores")
|
if(!root || root->getName()!="highscores")
|
||||||
{
|
{
|
||||||
if(root) delete root;
|
if(root) delete root;
|
||||||
|
root = NULL;
|
||||||
throw std::runtime_error("No 'highscore' node found.");
|
throw std::runtime_error("No 'highscore' node found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +105,7 @@ void HighscoreManager::loadHighscores()
|
|||||||
// calling Save() now will generate an empty file with the right format.
|
// calling Save() now will generate an empty file with the right format.
|
||||||
saveHighscores();
|
saveHighscores();
|
||||||
delete root;
|
delete root;
|
||||||
|
root = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +138,7 @@ void HighscoreManager::loadHighscores()
|
|||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "No old highscores will be available.\n");
|
fprintf(stderr, "No old highscores will be available.\n");
|
||||||
}
|
}
|
||||||
|
if(root)
|
||||||
delete root;
|
delete root;
|
||||||
} // loadHighscores
|
} // loadHighscores
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user