[Scummvm-cvs-logs] scummvm master -> 3550e1056884995a524db51fab56d0097c5b6398

hkzlab hkzlabnet at gmail.com
Mon Feb 28 19:24:35 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3550e10568 SWORD2: fix leak of previous commit properly


Commit: 3550e1056884995a524db51fab56d0097c5b6398
    https://github.com/scummvm/scummvm/commit/3550e1056884995a524db51fab56d0097c5b6398
Author: Fabio Battaglia (hkzlabnet at gmail.com)
Date: 2011-02-28T10:22:22-08:00

Commit Message:
SWORD2: fix leak of previous commit properly

Memorize psx sprite buffer pointer to properly free it

Changed paths:
    engines/sword2/animation.cpp



diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index e75e38a..c47b73e 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);
 	}
 }
 






More information about the Scummvm-git-logs mailing list