[Scummvm-cvs-logs] SF.net SVN: scummvm: [24589] scummvm/trunk
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Fri Nov 3 22:02:07 CET 2006
Revision: 24589
http://svn.sourceforge.net/scummvm/?rev=24589&view=rev
Author: cyx
Date: 2006-11-03 13:01:49 -0800 (Fri, 03 Nov 2006)
Log Message:
-----------
got rid of two memory leaks
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/common/advancedDetector.h
scummvm/trunk/engines/agos/game.cpp
scummvm/trunk/engines/cine/detection.cpp
scummvm/trunk/engines/saga/game.cpp
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2006-11-03 06:16:11 UTC (rev 24588)
+++ scummvm/trunk/common/advancedDetector.cpp 2006-11-03 21:01:49 UTC (rev 24589)
@@ -34,7 +34,7 @@
_fileMD5Bytes = 0;
}
-String AdvancedDetector::getDescription(int num) {
+String AdvancedDetector::getDescription(int num) const {
char tmp[256];
const ADGameDescription *g = _gameDescriptions[num];
@@ -67,7 +67,7 @@
assert(_gameDescriptions.size());
- matched = (int *)malloc(_gameDescriptions.size() * sizeof(int));
+ matched = new int[_gameDescriptions.size()];
// First we compose list of files which we need MD5s for
for (i = 0; i < _gameDescriptions.size(); i++) {
@@ -138,9 +138,8 @@
if (strcmp(fileDesc->md5, filesMD5[tstr].c_str()) && strcmp(fileDesc->md5, filesMD5[tstr2].c_str())) {
fileMissing = true;
break;
- } else {
- debug(3, "Matched file: %s", tstr.c_str());
}
+ debug(3, "Matched file: %s", tstr.c_str());
}
if (!fileMissing) {
debug(2, "Found game: %s", getDescription(i).c_str());
@@ -183,13 +182,13 @@
}
- ADList *returnMatches = new ADList;
- j = 0;
+ ADList returnMatches;
for (i = 0; i < matchedCount; i++)
if (matched[i] != -1)
- returnMatches->push_back(matched[i]);
+ returnMatches.push_back(matched[i]);
- return *returnMatches;
+ delete[] matched;
+ return returnMatches;
}
} // End of namespace Common
Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h 2006-11-03 06:16:11 UTC (rev 24588)
+++ scummvm/trunk/common/advancedDetector.h 2006-11-03 21:01:49 UTC (rev 24589)
@@ -79,7 +79,7 @@
int _fileMD5Bytes;
- String getDescription(int num);
+ String getDescription(int num) const;
};
} // End of namespace Common
Modified: scummvm/trunk/engines/agos/game.cpp
===================================================================
--- scummvm/trunk/engines/agos/game.cpp 2006-11-03 06:16:11 UTC (rev 24588)
+++ scummvm/trunk/engines/agos/game.cpp 2006-11-03 21:01:49 UTC (rev 24589)
@@ -219,8 +219,6 @@
}
}
- //delete &matches;
-
if (gameNumber >= ARRAYSIZE(gameDescriptions) || gameNumber == -1) {
error("AGOSEngine::loadGame wrong gameNumber");
}
Modified: scummvm/trunk/engines/cine/detection.cpp
===================================================================
--- scummvm/trunk/engines/cine/detection.cpp 2006-11-03 06:16:11 UTC (rev 24588)
+++ scummvm/trunk/engines/cine/detection.cpp 2006-11-03 21:01:49 UTC (rev 24589)
@@ -706,7 +706,6 @@
for (uint i = 0; i < matches.size(); i++)
detectedGames.push_back(toDetectedGame(gameDescriptions[matches[i]].desc));
- //delete &matches;
return detectedGames;
}
Modified: scummvm/trunk/engines/saga/game.cpp
===================================================================
--- scummvm/trunk/engines/saga/game.cpp 2006-11-03 06:16:11 UTC (rev 24588)
+++ scummvm/trunk/engines/saga/game.cpp 2006-11-03 21:01:49 UTC (rev 24589)
@@ -153,8 +153,6 @@
gameNumber = matches[0];
- //delete matches;
-
if (gameNumber >= gameCount || gameNumber == -1) {
error("SagaEngine::loadGame wrong gameNumber");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list