ref: 575b78d9e3b9c701edb5087aa1c5f9c4031d3548
parent: 74cebeae1249f8ebade559a7316fe84db7a36fd2
author: Sebastian Rasmussen <sebras@gmail.com>
date: Thu Jun 18 11:12:03 EDT 2020
[cff] Fix memory leak (#58610). * src/cff/cffobjs.c (cff_size_init): When the call to `funcs->create' fails, make sure to free `internal'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-06-19 Sebastian Rasmussen <sebras@gmail.com>
+
+ [cff] Fix memory leak (#58610).
+
+ * src/cff/cffobjs.c (cff_size_init): When the call to
+ `funcs->create' fails, make sure to free `internal'.
+
2020-06-19 Werner Lemberg <wl@gnu.org>
* src/cff/cffload.c (cff_index_get_pointers): Rename `t' to `tbl'.
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -166,15 +166,16 @@
FT_Error error = FT_Err_Ok;
PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size );
+ FT_Memory memory = cffsize->face->memory;
+ CFF_Internal internal = NULL;
+
if ( funcs )
{
- CFF_Face face = (CFF_Face)cffsize->face;
- CFF_Font font = (CFF_Font)face->extra.data;
- CFF_Internal internal = NULL;
+ CFF_Face face = (CFF_Face)cffsize->face;
+ CFF_Font font = (CFF_Font)face->extra.data;
PS_PrivateRec priv;
- FT_Memory memory = cffsize->face->memory;
FT_UInt i;
@@ -206,6 +207,9 @@
size->strike_index = 0xFFFFFFFFUL;
Exit:
+ if ( error )
+ FT_FREE( internal );
+
return error;
}