aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {