summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2019-07-12 11:36:12 +0200
committerWerner Lemberg <wl@gnu.org>2019-07-12 11:36:12 +0200
commitb110acba9e6f7e40314f0da5d249cb3cb3beeab8 (patch)
tree2dd16af59ef1dd2888f2c63c954787583402b3ef
parent12e4307dc7b48c9a4a4fc3ac6c32220874ab18ec (diff)
downloadfreetype2-b110acba9e6f7e40314f0da5d249cb3cb3beeab8.tar.gz
[sfnt, winfonts] Avoid memory leaks in case of error (#56587).
* src/sfnt/sfwoff.c (woff_open_font): Call `FT_FRAME_EXIT' in case of error. * src/winfonts/winfnt.c (fnt_face_get_dll_font): Ditto.
-rw-r--r--ChangeLog9
-rw-r--r--src/sfnt/sfwoff.c10
-rw-r--r--src/winfonts/winfnt.c6
3 files changed, 21 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 27b4c0d10..dfafdfbf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-07-12 Werner Lemberg <wl@gnu.org>
+
+ [sfnt, winfonts] Avoid memory leaks in case of error (#56587).
+
+ * src/sfnt/sfwoff.c (woff_open_font): Call `FT_FRAME_EXIT' in case
+ of error.
+
+ * src/winfonts/winfnt.c (fnt_face_get_dll_font): Ditto.
+
2019-07-12 Ben Wagner <bungeman@google.com>
Properly handle phantom points for variation fonts (#56601).
diff --git a/src/sfnt/sfwoff.c b/src/sfnt/sfwoff.c
index ca4821a20..c7eaca17f 100644
--- a/src/sfnt/sfwoff.c
+++ b/src/sfnt/sfwoff.c
@@ -371,18 +371,18 @@
sfnt + table->OrigOffset, &output_len,
stream->cursor, table->CompLength );
if ( error )
- goto Exit;
+ goto Exit1;
if ( output_len != table->OrigLength )
{
FT_ERROR(( "woff_font_open: compressed table length mismatch\n" ));
error = FT_THROW( Invalid_Table );
- goto Exit;
+ goto Exit1;
}
#else /* !FT_CONFIG_OPTION_USE_ZLIB */
error = FT_THROW( Unimplemented_Feature );
- goto Exit;
+ goto Exit1;
#endif /* !FT_CONFIG_OPTION_USE_ZLIB */
}
@@ -424,6 +424,10 @@
}
return error;
+
+ Exit1:
+ FT_FRAME_EXIT();
+ goto Exit;
}
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 2d771be2c..97eb6fc34 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -331,7 +331,7 @@
{
FT_TRACE2(( "invalid alignment shift count for resource data\n" ));
error = FT_THROW( Invalid_File_Format );
- goto Exit;
+ goto Exit1;
}
@@ -597,6 +597,10 @@
Exit:
return error;
+
+ Exit1:
+ FT_FRAME_EXIT();
+ goto Exit;
}