aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFabio Battaglia2011-02-28 19:22:22 +0100
committerFabio Battaglia2011-02-28 19:22:22 +0100
commit3550e1056884995a524db51fab56d0097c5b6398 (patch)
treed09e0d58b509e6d402c2e64b70c535146eb1e402 /engines
parent33d90412c19002b4c892d5ac693c051cbe81905d (diff)
downloadscummvm-rg350-3550e1056884995a524db51fab56d0097c5b6398.tar.gz
scummvm-rg350-3550e1056884995a524db51fab56d0097c5b6398.tar.bz2
scummvm-rg350-3550e1056884995a524db51fab56d0097c5b6398.zip
SWORD2: fix leak of previous commit properly
Memorize psx sprite buffer pointer to properly free it
Diffstat (limited to 'engines')
-rw-r--r--engines/sword2/animation.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index e75e38ad81..c47b73ef83 100644
--- a/engines/sword2/animation.cpp
+++ b/engines/sword2/animation.cpp
@@ -218,11 +218,12 @@ void MoviePlayer::drawTextObject(uint32 index, byte *screen, uint16 pitch) {
uint16 height = text->_textSprite.h;
// Resize text sprites for PSX version
+ byte *psxSpriteBuffer;
if (Sword2Engine::isPsx()) {
height *= 2;
- byte *buffer = (byte *)malloc(width * height);
- Screen::resizePsxSprite(buffer, src, width, height);
- src = buffer;
+ psxSpriteBuffer = (byte *)malloc(width * height);
+ Screen::resizePsxSprite(psxSpriteBuffer, src, width, height);
+ src = psxSpriteBuffer;
}
byte *dst = screen + _textY * pitch + _textX;
@@ -240,7 +241,7 @@ void MoviePlayer::drawTextObject(uint32 index, byte *screen, uint16 pitch) {
// Free buffer used to resize psx sprite
if (Sword2Engine::isPsx())
- free(src);
+ free(psxSpriteBuffer);
}
}