From edf554290ec1cb623d163c9d87a53ee2f4245295 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 1 Jul 2012 02:21:07 +0300 Subject: Fix leak in animatedsprite. --- src/animatedsprite.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/animatedsprite.cpp') 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); -- cgit v1.2.3-70-g09d2