[Scummvm-cvs-logs] scummvm master -> f81ce4d228e528f95cdc3329435aa4ed1eb79fe5

Strangerke Strangerke at scummvm.org
Sun Mar 31 23:58:20 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f81ce4d228 HOPKINS: Fix another error reported by Valgrind. Thanks Eriktorbjorn for reporting it


Commit: f81ce4d228e528f95cdc3329435aa4ed1eb79fe5
    https://github.com/scummvm/scummvm/commit/f81ce4d228e528f95cdc3329435aa4ed1eb79fe5
Author: Strangerke (strangerke at scummvm.org)
Date: 2013-03-31T14:57:26-07:00

Commit Message:
HOPKINS: Fix another error reported by Valgrind. Thanks Eriktorbjorn for reporting it

Changed paths:
    engines/hopkins/lines.cpp



diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index f838c05..d74bc8f 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) {






More information about the Scummvm-git-logs mailing list