diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-07-01 02:21:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-01 02:21:07 +0300 |
commit | edf554290ec1cb623d163c9d87a53ee2f4245295 (patch) | |
tree | 1ad87ebc90ef2dd3be9c4040a7e8a79e9e32301a /src/animatedsprite.cpp | |
parent | 59572017b51da88d07744c8feab64d356d2e33ff (diff) | |
download | manaplus-edf554290ec1cb623d163c9d87a53ee2f4245295.tar.gz manaplus-edf554290ec1cb623d163c9d87a53ee2f4245295.tar.bz2 manaplus-edf554290ec1cb623d163c9d87a53ee2f4245295.tar.xz manaplus-edf554290ec1cb623d163c9d87a53ee2f4245295.zip |
Fix leak in animatedsprite.
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r-- | src/animatedsprite.cpp | 6 |
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); |