[base] Fix memory leak. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=738362 * src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case of error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
diff --git a/ChangeLog b/ChangeLog
index d9bc844..56168da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-07-13 Werner Lemberg <wl@gnu.org>
+
+ [base] Fix memory leak.
+
+ Reported as
+
+ https://bugs.chromium.org/p/chromium/issues/detail?id=738362
+
+ * src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case
+ of error.
+
2017-07-12 Werner Lemberg <wl@gnu.org>
[base] Integer overflow.
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 62d94cb..3f78a8c 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -412,13 +412,15 @@
slot->advance.x <= -0x8000L * 64 )
{
FT_ERROR(( "FT_Get_Glyph: advance width too large\n" ));
- return FT_THROW( Invalid_Argument );
+ error = FT_THROW( Invalid_Argument );
+ goto Exit2;
}
if ( slot->advance.y >= 0x8000L * 64 ||
slot->advance.y <= -0x8000L * 64 )
{
FT_ERROR(( "FT_Get_Glyph: advance height too large\n" ));
- return FT_THROW( Invalid_Argument );
+ error = FT_THROW( Invalid_Argument );
+ goto Exit2;
}
glyph->advance.x = slot->advance.x * 1024;
@@ -427,6 +429,7 @@
/* now import the image from the glyph slot */
error = clazz->glyph_init( glyph, slot );
+ Exit2:
/* if an error occurred, destroy the glyph */
if ( error )
FT_Done_Glyph( glyph );