diff options
author | Paul Gilbert | 2010-09-08 11:45:17 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 23:43:44 +0000 |
commit | 30f199a5a449d612e026b3d3a0ccace3a870c40e (patch) | |
tree | 8d80970e6e22e0b634889646074e7cfc750db206 /engines/sword25 | |
parent | cbe304c3aefd4b409fc01f4e7d393bf1878a0564 (diff) | |
download | scummvm-rg350-30f199a5a449d612e026b3d3a0ccace3a870c40e.tar.gz scummvm-rg350-30f199a5a449d612e026b3d3a0ccace3a870c40e.tar.bz2 scummvm-rg350-30f199a5a449d612e026b3d3a0ccace3a870c40e.zip |
SWORD25: Fix memory leak in transparency commit
At the point where the alpha value was checked, a scaled image surface may have already been created, which needs to be freed.
svn-id: r53337
Diffstat (limited to 'engines/sword25')
-rw-r--r-- | engines/sword25/gfx/opengl/glimage.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index 31a52fbed7..08f66e340d 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -204,7 +204,7 @@ bool GLImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRect, ui Graphics::Surface *img; Graphics::Surface *imgScaled = NULL; - byte *savedPixels; + byte *savedPixels = NULL; if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = scale(srcImage, width, height); @@ -218,10 +218,6 @@ bool GLImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRect, ui int cg = (color >> 8) & 0xff; int cb = (color >> 0) & 0xff; - // Check if we need to draw anything at all - if (ca == 0) - return true; - if (ca != 255) { cr = cr * ca >> 8; cg = cg * ca >> 8; @@ -244,7 +240,7 @@ bool GLImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRect, ui img->w = CLIP((int)img->w, 0, (int)MAX((int)_backSurface->w - posX, 0)); img->h = CLIP((int)img->h, 0, (int)MAX((int)_backSurface->h - posY, 0)); - if (img->w > 0 && img->h > 0) { + if ((ca != 0) && (img->w > 0) && (img->h > 0)) { int xp = 0, yp = 0; int inStep = 4; |