From 7b8ff8b75278e4c009478a7d7fed0bb27f80a1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Andersson?= Date: Sun, 9 Nov 2008 09:58:59 +0000 Subject: [PATCH] Fixed warning, and what looked to me like a very minor memory leak. svn-id: r34946 --- engines/dialogs.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index a4997b89586..22480ea0828 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -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);