From 9b9671f5ee1261ff594f3b800b93811528de4f4b Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Wed, 15 Jan 2014 23:03:39 -0400 Subject: [PATCH] Fixed a potential memory leak when a Font object errors --- src/modules/graphics/opengl/Font.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index 2b4bf8750..1e5aab95c 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -186,7 +186,15 @@ Font::Glyph *Font::addGlyph(uint32 glyph) if (textureY + h + TEXTURE_PADDING > textureHeight) { // totally out of space - new texture! - createTexture(); + try + { + createTexture(); + } + catch (love::Exception &) + { + gd->release(); + throw; + } } Glyph *g = new Glyph;