summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-01 02:21:07 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-01 02:21:07 +0300
commitedf554290ec1cb623d163c9d87a53ee2f4245295 (patch)
tree1ad87ebc90ef2dd3be9c4040a7e8a79e9e32301a
parent59572017b51da88d07744c8feab64d356d2e33ff (diff)
downloadmanaverse-edf554290ec1cb623d163c9d87a53ee2f4245295.tar.gz
manaverse-edf554290ec1cb623d163c9d87a53ee2f4245295.tar.bz2
manaverse-edf554290ec1cb623d163c9d87a53ee2f4245295.tar.xz
manaverse-edf554290ec1cb623d163c9d87a53ee2f4245295.zip
Fix leak in animatedsprite.
-rw-r--r--src/animatedsprite.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 573c2ebc5..41a7aa215 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -77,8 +77,12 @@ AnimatedSprite *AnimatedSprite::delayedLoad(const std::string &filename,
if (!mEnableCache)
return load(filename, variant);
ResourceManager *resman = ResourceManager::getInstance();
- if (resman->getFromCache(filename, variant))
+ Resource *res = resman->getFromCache(filename, variant);
+ if (res)
+ {
+ res->decRef();
return load(filename, variant);
+ }
AnimatedSprite *as = new AnimatedSprite(nullptr);
as->setDelayLoad(filename, variant);