aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorD G Turner2012-03-28 01:11:41 +0100
committerD G Turner2012-03-28 01:11:41 +0100
commit6523a32334491532a7fe6f9efd96585d4d1188ce (patch)
tree0f177f25b3e5cdcdcdef88be39528baffbc77843 /engines
parent83d4eeadc63d40a465ca9713194505440253d398 (diff)
downloadscummvm-rg350-6523a32334491532a7fe6f9efd96585d4d1188ce.tar.gz
scummvm-rg350-6523a32334491532a7fe6f9efd96585d4d1188ce.tar.bz2
scummvm-rg350-6523a32334491532a7fe6f9efd96585d4d1188ce.zip
CGE: Close memory leak in sound Fx caching..
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/sound.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
index 646689e99e..7f74794474 100644
--- a/engines/cge/sound.cpp
+++ b/engines/cge/sound.cpp
@@ -148,8 +148,11 @@ void Fx::preload(int ref0) {
DataCk *wav = loadWave(&file);
if (wav) {
Handler *p = &_cache[find(0)];
- if (p >= cacheLim)
+ if (p >= cacheLim) {
+ delete wav;
break;
+ }
+ delete p->_wav;
p->_wav = wav;
p->_ref = ref;
} else {
@@ -166,6 +169,7 @@ DataCk *Fx::load(int idx, int ref) {
DataCk *wav = loadWave(&file);
if (wav) {
Handler *p = &_cache[idx];
+ delete p->_wav;
p->_wav = wav;
p->_ref = ref;
} else {