aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins
diff options
context:
space:
mode:
authorStrangerke2013-03-31 23:57:26 +0200
committerStrangerke2013-03-31 23:57:26 +0200
commitf81ce4d228e528f95cdc3329435aa4ed1eb79fe5 (patch)
tree85e268e17ed288068202511a1cdec450c46437b3 /engines/hopkins
parent3583a1cdc4ae922a4d9eb8745c3b21a2f7e9e91d (diff)
downloadscummvm-rg350-f81ce4d228e528f95cdc3329435aa4ed1eb79fe5.tar.gz
scummvm-rg350-f81ce4d228e528f95cdc3329435aa4ed1eb79fe5.tar.bz2
scummvm-rg350-f81ce4d228e528f95cdc3329435aa4ed1eb79fe5.zip
HOPKINS: Fix another error reported by Valgrind. Thanks Eriktorbjorn for reporting it
Diffstat (limited to 'engines/hopkins')
-rw-r--r--engines/hopkins/lines.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index f838c05436..d74bc8f3a0 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -67,9 +67,9 @@ LinesManager::LinesManager(HopkinsEngine *vm) {
_lastLine = 0;
_maxLineIdx = 0;
_pathFindingMaxDepth = 0;
- _testRoute0 = NULL;
- _testRoute1 = NULL;
- _testRoute2 = NULL;
+ _testRoute0 = (RouteItem *)g_PTRNUL;
+ _testRoute1 = (RouteItem *)g_PTRNUL;
+ _testRoute2 = (RouteItem *)g_PTRNUL;
_lineBuf = (int16 *)g_PTRNUL;
_route = (RouteItem *)g_PTRNUL;
_currentSegmentId = 0;
@@ -89,9 +89,12 @@ LinesManager::LinesManager(HopkinsEngine *vm) {
LinesManager::~LinesManager() {
_vm->_globals->freeMemory(_largeBuf);
- _vm->_globals->freeMemory((byte *) _testRoute0);
- _vm->_globals->freeMemory((byte *) _testRoute1);
- _vm->_globals->freeMemory((byte *) _testRoute2);
+ if (_testRoute0 != (RouteItem *)g_PTRNUL)
+ delete[] _testRoute0;
+ if (_testRoute1 != (RouteItem *)g_PTRNUL)
+ delete[] _testRoute1;
+ if (_testRoute2 != (RouteItem *)g_PTRNUL)
+ delete[] _testRoute2;
}
int LigneItem::appendToRouteInc(int from, int to, RouteItem *route, int index) {