aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mortevielle/mortevielle.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index 6977ab47c0..46c7c75fa3 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -170,8 +170,10 @@ Common::ErrorCode MortevielleEngine::initialise() {
// Load the mort.dat resource
Common::ErrorCode result = loadMortDat();
- if (result != Common::kNoError)
+ if (result != Common::kNoError) {
+ _screenSurface.free();
return result;
+ }
// Load some error messages (was previously in chartex())
_hintPctMessage = getString(580); // You should have noticed %d hints
@@ -204,8 +206,6 @@ Common::ErrorCode MortevielleEngine::initialise() {
_currGraphicalDevice = _newGraphicalDevice;
hirs();
- free(_cfiecBuffer);
- free(_speechManager._cfiphBuffer);
return Common::kNoError;
}
@@ -339,6 +339,11 @@ Common::Error MortevielleEngine::run() {
// Run the main game loop
mainGame();
+
+ // Cleanup (allocated in initialise())
+ _screenSurface.free();
+ free(_speechManager._cfiphBuffer);
+ free(_cfiecBuffer);
return Common::kNoError;
}