From 26901479d3e60eed76dfd306988b27408b22e3ee Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 17 Jun 2014 15:38:24 +0200 Subject: CGE2: Fix initialization of _posTab. Fixes a possible memory leak. --- engines/cge2/cge2_main.cpp | 1 + engines/cge2/hero.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 0fc2d5af71..5fa44531df 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -733,6 +733,7 @@ void CGE2Engine::loadPos() { EncryptedStream file(this, "CGE.HXY"); for (int cav = 0; cav < kSceneMax; cav++) { + _heroTab[0]->_posTab[cav] = new V2D(this); _heroTab[0]->_posTab[cav]->x = file.readSint16LE(); _heroTab[0]->_posTab[cav]->y = file.readSint16LE(); } diff --git a/engines/cge2/hero.h b/engines/cge2/hero.h index 628f7c1580..7ddc871e06 100644 --- a/engines/cge2/hero.h +++ b/engines/cge2/hero.h @@ -52,7 +52,7 @@ struct HeroTab { _pocket[i] = nullptr; _pocPtr = 0; for (int i = 0; i < kSceneMax; i++) - _posTab[i] = new V2D(vm); + _posTab[i] = nullptr; } ~HeroTab() { for (int i = 0; i < kSceneMax; i++) -- cgit v1.2.3