summaryrefslogtreecommitdiffstats
path: root/src/graphics/engine
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-16 20:00:25 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-16 20:00:25 +0200
commit2e21435f432191afa1b0f609daa8ca9d4cde1e93 (patch)
treef59b3d80815c2017f4992f0d26e41a439d75e30b /src/graphics/engine
parent6a0d150539897ec65ccc161305db48de10ea35ba (diff)
downloadcolobot-2e21435f432191afa1b0f609daa8ca9d4cde1e93.tar.gz
colobot-2e21435f432191afa1b0f609daa8ca9d4cde1e93.tar.bz2
colobot-2e21435f432191afa1b0f609daa8ca9d4cde1e93.zip
Some memory leaks fixed
Diffstat (limited to 'src/graphics/engine')
-rw-r--r--src/graphics/engine/text.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp
index 19ef57b..8fc8709 100644
--- a/src/graphics/engine/text.cpp
+++ b/src/graphics/engine/text.cpp
@@ -785,18 +785,20 @@ Gfx::CharTexture Gfx::CText::CreateCharTexture(Gfx::UTF8Char ch, Gfx::CachedFont
data.surface = nullptr;
- SDL_FreeSurface(textSurface);
- SDL_FreeSurface(textureSurface);
-
if (! tex.Valid())
{
m_error = "Texture create error";
return texture;
}
+ else
+ {
+ texture.id = tex.id;
+ texture.texSize = m_engine->WindowToInterfaceSize(Math::IntPoint(textureSurface->w, textureSurface->h));
+ texture.charSize = m_engine->WindowToInterfaceSize(Math::IntPoint(textSurface->w, textSurface->h));
+ }
- texture.id = tex.id;
- texture.texSize = m_engine->WindowToInterfaceSize(Math::IntPoint(textureSurface->w, textureSurface->h));
- texture.charSize = m_engine->WindowToInterfaceSize(Math::IntPoint(textSurface->w, textSurface->h));
+ SDL_FreeSurface(textSurface);
+ SDL_FreeSurface(textureSurface);
return texture;
}