提交 e12dd584 编写于 作者: G Grissiom

freetype: fix a memory leak

Roughly backport of commit 75534a04327b54f upstream.
上级 8031b624
......@@ -3496,7 +3496,7 @@
{
FT_ERROR(( "tt_face_build_cmaps:"
" unsupported `cmap' table format = %d\n",
TT_PEEK_USHORT( p - 2) ));
TT_PEEK_USHORT( p - 2 ) ));
return FT_THROW( Invalid_Table );
}
......
......@@ -3059,7 +3059,7 @@
#define DO_MD /* nothing */
#define DO_MPPEM \
#define DO_MPPEM \
args[0] = CUR_Func_cur_ppem();
......@@ -3072,7 +3072,7 @@
#else
#define DO_MPS \
#define DO_MPS \
args[0] = CUR_Func_cur_ppem();
#endif /* 0 */
......@@ -5625,7 +5625,7 @@
/*************************************************************************/
/* */
/* INSTCTRL[]: INSTruction ConTRoL */
/* Opcode range: 0x8e */
/* Opcode range: 0x8E */
/* Stack: int32 int32 --> */
/* */
static void
......@@ -7654,7 +7654,7 @@
}
#endif
P = (FT_ULong)CUR_Func_cur_ppem();
P = (FT_ULong)CUR_Func_cur_ppem();
nump = (FT_ULong)args[0];
for ( k = 1; k <= nump; k++ )
......@@ -9004,9 +9004,9 @@
/* If any errors have occurred, function tables may be broken. */
/* Force a re-execution of `prep' and `fpgm' tables if no */
/* bytecode debugger is run. */
if ( CUR.error
&& !CUR.instruction_trap
&& CUR.curRange == tt_coderange_glyph )
if ( CUR.error &&
!CUR.instruction_trap &&
CUR.curRange == tt_coderange_glyph )
{
FT_TRACE1(( " The interpreter returned error 0x%x\n", CUR.error ));
exc->size->bytecode_ready = -1;
......
......@@ -256,89 +256,89 @@
#define TRICK_SFNT_ID_prep 2
{ /* MingLiU 1995 */
{ 0x05bcf058, 0x000002e4 }, /* cvt */
{ 0x28233bf1, 0x000087c4 }, /* fpgm */
{ 0xa344a1ea, 0x000001e1 } /* prep */
{ 0x05BCF058UL, 0x000002E4UL }, /* cvt */
{ 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
{ 0xA344A1EAUL, 0x000001E1UL } /* prep */
},
{ /* MingLiU 1996- */
{ 0x05bcf058, 0x000002e4 }, /* cvt */
{ 0x28233bf1, 0x000087c4 }, /* fpgm */
{ 0xa344a1eb, 0x000001e1 } /* prep */
{ 0x05BCF058UL, 0x000002E4UL }, /* cvt */
{ 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
{ 0xA344A1EBUL, 0x000001E1UL } /* prep */
},
{ /* DFKaiShu */
{ 0x11e5ead4, 0x00000350 }, /* cvt */
{ 0x5a30ca3b, 0x00009063 }, /* fpgm */
{ 0x13a42602, 0x0000007e } /* prep */
{ 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
{ 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */
{ 0x13A42602UL, 0x0000007EUL } /* prep */
},
{ /* HuaTianKaiTi */
{ 0xfffbfffc, 0x00000008 }, /* cvt */
{ 0x9c9e48b8, 0x0000bea2 }, /* fpgm */
{ 0x70020112, 0x00000008 } /* prep */
{ 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
{ 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */
{ 0x70020112UL, 0x00000008UL } /* prep */
},
{ /* HuaTianSongTi */
{ 0xfffbfffc, 0x00000008 }, /* cvt */
{ 0x0a5a0483, 0x00017c39 }, /* fpgm */
{ 0x70020112, 0x00000008 } /* prep */
{ 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
{ 0x0A5A0483UL, 0x00017C39UL }, /* fpgm */
{ 0x70020112UL, 0x00000008UL } /* prep */
},
{ /* NEC fadpop7.ttf */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x40c92555, 0x000000e5 }, /* fpgm */
{ 0xa39b58e3, 0x0000117c } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x40C92555UL, 0x000000E5UL }, /* fpgm */
{ 0xA39B58E3UL, 0x0000117CUL } /* prep */
},
{ /* NEC fadrei5.ttf */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x33c41652, 0x000000e5 }, /* fpgm */
{ 0x26d6c52a, 0x00000f6a } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x33C41652UL, 0x000000E5UL }, /* fpgm */
{ 0x26D6C52AUL, 0x00000F6AUL } /* prep */
},
{ /* NEC fangot7.ttf */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x6db1651d, 0x0000019d }, /* fpgm */
{ 0x6c6e4b03, 0x00002492 } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x6DB1651DUL, 0x0000019DUL }, /* fpgm */
{ 0x6C6E4B03UL, 0x00002492UL } /* prep */
},
{ /* NEC fangyo5.ttf */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x40c92555, 0x000000e5 }, /* fpgm */
{ 0xde51fad0, 0x0000117c } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x40C92555UL, 0x000000E5UL }, /* fpgm */
{ 0xDE51FAD0UL, 0x0000117CUL } /* prep */
},
{ /* NEC fankyo5.ttf */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x85e47664, 0x000000e5 }, /* fpgm */
{ 0xa6c62831, 0x00001caa } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x85E47664UL, 0x000000E5UL }, /* fpgm */
{ 0xA6C62831UL, 0x00001CAAUL } /* prep */
},
{ /* NEC fanrgo5.ttf */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x2d891cfd, 0x0000019d }, /* fpgm */
{ 0xa0604633, 0x00001de8 } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x2D891CFDUL, 0x0000019DUL }, /* fpgm */
{ 0xA0604633UL, 0x00001DE8UL } /* prep */
},
{ /* NEC fangot5.ttc */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x40aa774c, 0x000001cb }, /* fpgm */
{ 0x9b5caa96, 0x00001f9a } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x40AA774CUL, 0x000001CBUL }, /* fpgm */
{ 0x9B5CAA96UL, 0x00001F9AUL } /* prep */
},
{ /* NEC fanmin3.ttc */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x0d3de9cb, 0x00000141 }, /* fpgm */
{ 0xd4127766, 0x00002280 } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x0D3DE9CBUL, 0x00000141UL }, /* fpgm */
{ 0xD4127766UL, 0x00002280UL } /* prep */
},
{ /* NEC FA-Gothic, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x4a692698, 0x000001f0 }, /* fpgm */
{ 0x340d4346, 0x00001fca } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x4A692698UL, 0x000001F0UL }, /* fpgm */
{ 0x340D4346UL, 0x00001FCAUL } /* prep */
},
{ /* NEC FA-Minchou, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0xcd34c604, 0x00000166 }, /* fpgm */
{ 0x6cf31046, 0x000022b0 } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0xCD34C604UL, 0x00000166UL }, /* fpgm */
{ 0x6CF31046UL, 0x000022B0UL } /* prep */
},
{ /* NEC FA-RoundGothicB, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x5da75315, 0x0000019d }, /* fpgm */
{ 0x40745a5f, 0x000022e0 } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0x5DA75315UL, 0x0000019DUL }, /* fpgm */
{ 0x40745A5FUL, 0x000022E0UL } /* prep */
},
{ /* NEC FA-RoundGothicM, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0xf055fc48, 0x000001c2 }, /* fpgm */
{ 0x3900ded3, 0x00001e18 } /* prep */
{ 0x00000000UL, 0x00000000UL }, /* cvt */
{ 0xF055FC48UL, 0x000001C2UL }, /* fpgm */
{ 0x3900DED3UL, 0x00001E18UL } /* prep */
}
};
......@@ -972,6 +972,15 @@
FT_UShort n_twilight;
TT_MaxProfile* maxp = &face->max_profile;
/* clean up bytecode related data */
FT_FREE( size->function_defs );
FT_FREE( size->instruction_defs );
FT_FREE( size->cvt );
FT_FREE( size->storage );
if ( size->context )
TT_Done_Context( size->context );
tt_glyphzone_done( &size->twilight );
size->bytecode_ready = -1;
size->cvt_ready = -1;
......@@ -1116,6 +1125,7 @@
TT_Size size = (TT_Size)ttsize;
FT_Error error = FT_Err_Ok;
#ifdef TT_USE_BYTECODE_INTERPRETER
size->bytecode_ready = -1;
size->cvt_ready = -1;
......@@ -1146,8 +1156,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
if ( size->bytecode_ready >= 0 )
tt_size_done_bytecode( ttsize );
tt_size_done_bytecode( ttsize );
#endif
size->ttmetrics.valid = FALSE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册