diff options
author | Max Horn | 2010-02-17 23:36:50 +0000 |
---|---|---|
committer | Max Horn | 2010-02-17 23:36:50 +0000 |
commit | 26b7f0bbb95dad5fc05fc5aec8d675ab7fab9041 (patch) | |
tree | 99d66f180511a7b182b2d36b3c2460d8edc98799 /engines/sci/detection.cpp | |
parent | 3452f5ea2d95e7ff477557a49b89e15c07351bbe (diff) | |
download | scummvm-rg350-26b7f0bbb95dad5fc05fc5aec8d675ab7fab9041.tar.gz scummvm-rg350-26b7f0bbb95dad5fc05fc5aec8d675ab7fab9041.tar.bz2 scummvm-rg350-26b7f0bbb95dad5fc05fc5aec8d675ab7fab9041.zip |
SCI: Remove hack in convertSierraGameId which caused a memory leak
svn-id: r48083
Diffstat (limited to 'engines/sci/detection.cpp')
-rw-r--r-- | engines/sci/detection.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index d44835c8c4..62099c1b6b 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -121,7 +121,7 @@ static const PlainGameDescriptor SciGameTitles[] = { /** * The fallback game descriptor used by the SCI engine's fallbackDetector. - * Contents of this struct are to be overwritten by the fallbackDetector. + * Contents of this struct are overwritten by the fallbackDetector. */ static ADGameDescription s_fallbackDesc = { "", @@ -133,6 +133,8 @@ static ADGameDescription s_fallbackDesc = { Common::GUIO_NONE }; +static char s_fallbackGameIdBuf[256]; + static const ADParams detectionParams = { // Pointer to ADGameDescription or its superset structure @@ -314,9 +316,12 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl return 0; } reg_t game_obj = segMan->lookupScriptExport(0, 0); - const char *gameId = segMan->getObjectName(game_obj); - debug(2, "Detected ID: \"%s\" at %04x:%04x", gameId, PRINT_REG(game_obj)); - s_fallbackDesc.gameid = convertSierraGameId(gameId, &s_fallbackDesc.flags, resMan); + const char *sierraGameId = segMan->getObjectName(game_obj); + debug(2, "Detected ID: \"%s\" at %04x:%04x", sierraGameId, PRINT_REG(game_obj)); + Common::String gameId = convertSierraGameId(sierraGameId, &s_fallbackDesc.flags, resMan); + strncpy(s_fallbackGameIdBuf, gameId.c_str(), sizeof(s_fallbackGameIdBuf) - 1); + s_fallbackGameIdBuf[sizeof(s_fallbackGameIdBuf) - 1] = 0; // Make sure string is NULL terminated + s_fallbackDesc.gameid = s_fallbackGameIdBuf; delete segMan; // Try to determine the game language |