Ignore script if subtable is missing (Coverity defect #2088).
Fix possible null pointer dereference (Coverity defect #784) and memory
leak (Coverity defects #785, #786).
Don't copy FcCharSet if we're going to throw it away anyway. (Reported by
Kenichi Handa).
reviewed by: plam
+2006-04-12 Frederic Crozat <fcrozat@mandriva.com>
+ reviewed by: plam
+
+ * src/fcpat.c: (FcPatternFreeze):
+ Fix memory leak (Coverity defect #2089).
+
+ * src/fcfreetype.c: (GetScriptTags):
+ Ignore script if subtable is missing (Coverity defect #2088).
+
+2006-04-12 Patrick Lam <plam@mit.edu>
+ * src/fccfg.c (FcConfigSubstituteWithPat):
+
+ Fix possible null pointer dereference (Coverity defect #784)
+ and memory leak (Coverity defects #785, #786).
+
+2006-04-12 Patrick Lam <plam@mit.edu>
+ * src/fcmatch.c (FcSortWalk, FcFontSetSort):
+
+ Don't copy FcCharSet if we're going to throw it away anyway.
+ (Reported by Kenichi Handa).
+
2006-04-11 Ming Zhao <ming@gentoo.org>
reviewed by: plam
/*
* Delete the marked value
*/
- FcConfigDel (&st[i].elt->values, thisValue);
+ if (thisValue)
+ FcConfigDel (&st[i].elt->values, thisValue);
/*
* Adjust any pointers into the value list to ensure
* future edits occur at the same place
FcConfigPatternAdd (p, e->field, l, FcTrue);
break;
default:
+ FcValueListDestroy (FcValueListPtrCreateDynamic(l));
break;
}
}
cur_offset = ftglue_stream_pos( stream );
- if (( error = ftglue_stream_seek( stream, new_offset ) ))
- goto Fail;
+ error = ftglue_stream_seek( stream, new_offset );
if ( error == TT_Err_Ok )
p++;
- else if ( error != TTO_Err_Empty_Script )
- goto Fail;
(void)ftglue_stream_seek( stream, cur_offset );
}
}
static FcBool
-FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool trim)
+FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool trim, FcBool build_cs)
{
FcCharSet *ncs;
FcSortNode *node;
*/
if (!trim || !*cs || !FcCharSetIsSubset (ncs, *cs))
{
- if (*cs)
- {
- ncs = FcCharSetUnion (ncs, *cs);
- if (!ncs)
- return FcFalse;
- FcCharSetDestroy (*cs);
- }
- else
- ncs = FcCharSetCopy (ncs);
- *cs = ncs;
+ if (!trim && build_cs)
+ {
+ if (*cs)
+ {
+ ncs = FcCharSetUnion (ncs, *cs);
+ if (!ncs)
+ return FcFalse;
+ FcCharSetDestroy (*cs);
+ }
+ else
+ ncs = FcCharSetCopy (ncs);
+ *cs = ncs;
+ }
+
FcPatternReference (node->pattern);
if (FcDebug () & FC_DBG_MATCH)
{
cs = 0;
- if (!FcSortWalk (nodeps, nnodes, ret, &cs, trim))
+ if (!FcSortWalk (nodeps, nnodes, ret, &cs, trim, (csp!=0)))
goto bail2;
if (csp)
*csp = cs;
else
- FcCharSetDestroy (cs);
+ {
+ if (cs)
+ FcCharSetDestroy (cs);
+ }
free (nodes);
FcPattern *
FcPatternFreeze (FcPattern *p)
{
- FcPattern *b, *n = 0;
+ FcPattern *b, *n = 0, *freeme = 0;
FcPatternElt *e;
int i;
(FcPatternEltU(b->elts)+i)->values =
FcValueListFreeze((FcPatternEltU(p->elts)+i)->values);
if (!FcValueListPtrU((FcPatternEltU(p->elts)+i)->values))
+ {
+ freeme = b;
goto bail;
+ }
}
if (FcPatternFindElt (p, FC_FILE))
b->elts = FcPatternEltPtrCreateDynamic(0);
FcMemFree (FC_MEM_PATELT, sizeof (FcPatternElt)*(b->num));
b->num = -1;
+ if (freeme)
+ FcPatternDestroy (freeme);
#ifdef DEBUG
assert (FcPatternEqual (n, p));
#endif