aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2013-06-30 13:26:07 -0600
committerThierry Crozat2013-06-30 13:26:07 -0600
commit730a1373d9837c340e6e646aaa4fbdce4574620a (patch)
tree1a2f3791bbb73781b6f5b588736c1a096e87e2d6
parentc2610d66e1d0ceb0ab29243a0dcddd2b8dadd22e (diff)
downloadscummvm-rg350-730a1373d9837c340e6e646aaa4fbdce4574620a.tar.gz
scummvm-rg350-730a1373d9837c340e6e646aaa4fbdce4574620a.tar.bz2
scummvm-rg350-730a1373d9837c340e6e646aaa4fbdce4574620a.zip
MORTEVIELLE: Fix access to free'ed memory
Two buffers were allocated and then free'ed in initialise(), which caused memory issues when accessed later on throughout the game. They are now free'ed from the MortevielleEngine destructor.
-rw-r--r--engines/mortevielle/mortevielle.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index 6977ab47c0..7220cd6b58 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -101,6 +101,10 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g
}
MortevielleEngine::~MortevielleEngine() {
+ // Allocated from run() > initialise() > loadCFIPH()
+ free(_speechManager._cfiphBuffer);
+ // Allocated from run() > initialise() > loadCFIEC()
+ free(_cfiecBuffer);
}
/**
@@ -204,8 +208,6 @@ Common::ErrorCode MortevielleEngine::initialise() {
_currGraphicalDevice = _newGraphicalDevice;
hirs();
- free(_cfiecBuffer);
- free(_speechManager._cfiphBuffer);
return Common::kNoError;
}