From aac47c97772d12852f62e9f90379999fc72976a2 Mon Sep 17 00:00:00 2001 From: Shenjoku Date: Mon, 29 Apr 2013 16:29:55 -0400 Subject: [PATCH] Fix potential leak in Font --- src/Font.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Font.cpp b/src/Font.cpp index a2f9824993..e0c3841bbc 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -741,8 +741,6 @@ void Font::Load( const RString &sIniPath, RString sChars ) { const RString &sTexturePath = asTexturePaths[i]; - FontPage *pPage = new FontPage; - // Grab the page name, eg "foo" from "Normal [foo].png". RString sPagename = GetPageNameFromFileName( sTexturePath ); @@ -750,6 +748,9 @@ void Font::Load( const RString &sIniPath, RString sChars ) if( sTexturePath.find("-stroke") != string::npos ) continue; + // Create this down here so it doesn't leak if the continue gets triggered. + FontPage *pPage = new FontPage; + // Load settings for this page from the INI. FontPageSettings cfg; LoadFontPageSettings( cfg, ini, sTexturePath, "common", sChars );