[FONT][WIN32SS] Fix a memory leak
authorMark Jansen <mark.jansen@reactos.org>
Sat, 29 Dec 2018 18:46:04 +0000 (19:46 +0100)
committerMark Jansen <mark.jansen@reactos.org>
Sat, 29 Dec 2018 18:47:00 +0000 (19:47 +0100)
win32ss/gdi/ntgdi/freetype.c

index e24e79c..08d164a 100644 (file)
@@ -6050,8 +6050,12 @@ GreExtTextOutW(
             if ( !HSourceGlyph )
             {
                 DPRINT1("WARNING: EngCreateBitmap() failed!\n");
-                // FT_Done_Glyph(realglyph);
                 bResult = FALSE;
+                if (EmuBold || EmuItalic)
+                {
+                    FT_Done_Glyph(realglyph);
+                }
+
                 break;
             }
             SourceGlyphSurf = EngLockSurface((HSURF)HSourceGlyph);
@@ -6060,6 +6064,11 @@ GreExtTextOutW(
                 EngDeleteSurface((HSURF)HSourceGlyph);
                 DPRINT1("WARNING: EngLockSurface() failed!\n");
                 bResult = FALSE;
+                if (EmuBold || EmuItalic)
+                {
+                    FT_Done_Glyph(realglyph);
+                }
+
                 break;
             }
 
@@ -6108,6 +6117,11 @@ GreExtTextOutW(
 
         if (DoBreak)
         {
+            if (EmuBold || EmuItalic)
+            {
+                FT_Done_Glyph(realglyph);
+            }
+
             break;
         }