Fixed warning, and what looked to me like a very minor memory leak.

svn-id: r34946
This commit is contained in:
Torbjörn Andersson 2008-11-09 09:58:59 +00:00
parent 93499c8032
commit 7b8ff8b752

View File

@ -169,13 +169,14 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// FIXME: at this point, the save list's selItem is -1!
//Common::String result(_saveDialog->getResultString());
Common::String result;
char *desc;
const char *desc;
if (result.empty()) {
// If the user was lazy and entered no save name, come up with a default name.
desc = new char[20];
sprintf(desc, "Save %d", slot + 1);
char buf[20];
sprintf(buf, "Save %d", slot + 1);
desc = buf;
} else {
desc = (char*)result.c_str();
desc = result.c_str();
}
_engine->saveGameState(slot, desc);