Fixed a potential memory leak when a Font object errors

This commit is contained in:
Alex Szpakowski
2014-01-15 23:03:39 -04:00
parent 7f77c2d0b3
commit 9b9671f5ee
+8
View File
@@ -186,8 +186,16 @@ Font::Glyph *Font::addGlyph(uint32 glyph)
if (textureY + h + TEXTURE_PADDING > textureHeight) if (textureY + h + TEXTURE_PADDING > textureHeight)
{ {
// totally out of space - new texture! // totally out of space - new texture!
try
{
createTexture(); createTexture();
} }
catch (love::Exception &)
{
gd->release();
throw;
}
}
Glyph *g = new Glyph; Glyph *g = new Glyph;