[Scummvm-cvs-logs] scummvm master -> 617b9cf613cb3ac67a033e38fd6fd1bcdf3b19ad

wjp wjp at usecode.org
Mon Apr 22 22:28:24 CEST 2013


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

Summary:
22d8fe9544 SWORD2: Fix (unlikely) memory leak
617b9cf613 SWORD2: Fix reference to out-of-scope variable


Commit: 22d8fe9544462af6d14e87df8ec2f6b70c5871bf
    https://github.com/scummvm/scummvm/commit/22d8fe9544462af6d14e87df8ec2f6b70c5871bf
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2013-04-22T13:22:43-07:00

Commit Message:
SWORD2: Fix (unlikely) memory leak

Changed paths:
    engines/sword2/sprite.cpp



diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp
index 91a5e2e..5e25a86 100644
--- a/engines/sword2/sprite.cpp
+++ b/engines/sword2/sprite.cpp
@@ -590,8 +590,11 @@ int32 Screen::drawSprite(SpriteInfo *s) {
 					s->w = (decompData / (s->h / 2));
 					sprite = (byte *)malloc(s->w * s->h);
 
-					if (!sprite)
+					if (!sprite) {
+						free(tempBuf);
+
 						return RDERR_OUTOFMEMORY;
+					}
 
 					resizePsxSprite(sprite, tempBuf, s->w, s->h);
 					free(tempBuf);


Commit: 617b9cf613cb3ac67a033e38fd6fd1bcdf3b19ad
    https://github.com/scummvm/scummvm/commit/617b9cf613cb3ac67a033e38fd6fd1bcdf3b19ad
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2013-04-22T13:27:19-07:00

Commit Message:
SWORD2: Fix reference to out-of-scope variable

Changed paths:
    engines/sword2/palette.cpp



diff --git a/engines/sword2/palette.cpp b/engines/sword2/palette.cpp
index c3a3d24..9634d3a 100644
--- a/engines/sword2/palette.cpp
+++ b/engines/sword2/palette.cpp
@@ -288,19 +288,17 @@ void Screen::fadeServer() {
 }
 
 void Screen::setSystemPalette(const byte *colors, uint start, uint num) {
-	const byte *palette;
-
 	if (_dimPalette) {
 		byte pal[256 * 3];
 
 		for (uint i = start * 3; i < 3 * (start + num); i++)
 			pal[i] = colors[i] / 2;
 
-		palette = pal;
-	} else
-		palette = colors;
+		_vm->_system->getPaletteManager()->setPalette(pal, start, num);
+	} else {
+		_vm->_system->getPaletteManager()->setPalette(colors, start, num);
+	}
 
-	_vm->_system->getPaletteManager()->setPalette(palette, start, num);
 }
 
 } // End of namespace Sword2






More information about the Scummvm-git-logs mailing list