summaryrefslogtreecommitdiff
path: root/src/compoundsprite.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-05-21 01:55:18 -0600
committerJared Adams <jaxad0127@gmail.com>2010-05-21 01:55:18 -0600
commit2405b9500e0f87da4e3623c8f083247036c51297 (patch)
tree420ee356e9ecf7a16631082b594d17834449e349 /src/compoundsprite.cpp
parent487a86fe7dc9904f445d91667095f641f72f7c81 (diff)
downloadmana-client-2405b9500e0f87da4e3623c8f083247036c51297.tar.gz
mana-client-2405b9500e0f87da4e3623c8f083247036c51297.tar.bz2
mana-client-2405b9500e0f87da4e3623c8f083247036c51297.tar.xz
mana-client-2405b9500e0f87da4e3623c8f083247036c51297.zip
Fix some memory leaks in SDL layerd sprite buffering
Diffstat (limited to 'src/compoundsprite.cpp')
-rw-r--r--src/compoundsprite.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index 53fdd7c2..c01b11c3 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -49,6 +49,9 @@ CompoundSprite::~CompoundSprite()
delete (*it);
clear();
+
+ delete mImage;
+ delete mAlphaImage;
}
bool CompoundSprite::reset()
@@ -297,8 +300,14 @@ void CompoundSprite::redraw() const
SDL_SetAlpha(surface, 0, SDL_ALPHA_OPAQUE);
SDL_BlitSurface(surface, NULL, surfaceA, NULL);
+ delete mImage;
+ delete mAlphaImage;
+
mImage = Image::load(surface);
+ SDL_FreeSurface(surface);
+
mAlphaImage = Image::load(surfaceA);
+ SDL_FreeSurface(surfaceA);
mNeedsRedraw = false;
}