https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2e44e5ce54ea67a6cc29003a72500f05ebad7a43

commit 2e44e5ce54ea67a6cc29003a72500f05ebad7a43
Author:     Mark Jansen <[email protected]>
AuthorDate: Sat Dec 29 19:46:04 2018 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sat Dec 29 19:47:00 2018 +0100

    [FONT][WIN32SS] Fix a memory leak
---
 win32ss/gdi/ntgdi/freetype.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index e24e79cc22..08d164a2eb 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -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;
         }
 

Reply via email to