summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Kacvinsky <tom.kacvinsky@3ds.com>2001-10-21 20:26:59 +0000
committerTom Kacvinsky <tom.kacvinsky@3ds.com>2001-10-21 20:26:59 +0000
commitc1130459e841083fb6f44f7870e8486a2a0a8579 (patch)
tree284bb170dae71f95a4079cd5c8d8662d0604d014
parentc5d0d00cdc37a4eddead8ce589fefe8e1316baee (diff)
downloadfreetype2-c1130459e841083fb6f44f7870e8486a2a0a8579.tar.gz
In function CFF_Done_Font, make sure that subfonts are freed only if
we are working with a CID keyed CFF font. This is to avoid freeing a variable that might not have been allocated.
-rw-r--r--src/cff/cffload.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 3df2eaba0..075351fc6 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -2242,11 +2242,14 @@
cff_done_index( &font->name_index );
cff_done_index( &font->charstrings_index );
- /* release font dictionaries */
- for ( index = 0; index < font->num_subfonts; index++ )
- CFF_Done_SubFont( memory, font->subfonts[index] );
+ /* release font dictionaries, but only if working with a CID keyed CFF font */
+ if ( font->num_subfonts > 0 )
+ {
+ for ( index = 0; index < font->num_subfonts; index++ )
+ CFF_Done_SubFont( memory, font->subfonts[index] );
- FREE( font->subfonts );
+ FREE( font->subfonts );
+ }
CFF_Done_Encoding( &font->encoding, font->stream );
CFF_Done_Charset( &font->charset, font->stream );