Missing bits from previous patches.
Remove extra semi-colon. Fix memory leak in error case (Coverity defects #776, #985). Fix memory leaks (Coverity defects #779, #781) and memory use after free (Coverity defect #780). reviewed by: plam
This commit is contained in:
parent
04f7d3e7fd
commit
2de24638b2
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
2006-04-11 Frederic Crozat <fcrozat@mandriva.com>
|
||||||
|
reviewed by: plam
|
||||||
|
|
||||||
|
* src/fccharset.c: (FcCharSetPutLeaf):
|
||||||
|
* src/fclang.c: (FcNameUnparseLangSet):
|
||||||
|
|
||||||
|
Missing bits from previous patches.
|
||||||
|
|
||||||
|
* src/fccharset.c (FcCharSetSubtractCount):
|
||||||
|
Remove extra semi-colon.
|
||||||
|
|
||||||
|
* src/fccfg.c: (FcConfigBuildFonts):
|
||||||
|
Fix memory leak in error case (Coverity defects #776, #985).
|
||||||
|
|
||||||
|
* src/fcxml.c: (FcPopBinary, FcParsePatelt, FcParsePattern):
|
||||||
|
Fix memory leaks (Coverity defects #779, #781)
|
||||||
|
and memory use after free (Coverity defect #780).
|
||||||
|
|
||||||
2006-04-11 Patrick Lam <plam@mit.edu>
|
2006-04-11 Patrick Lam <plam@mit.edu>
|
||||||
* src/fccharset.c (FcCharSetPutLeaf):
|
* src/fccharset.c (FcCharSetPutLeaf):
|
||||||
|
|
||||||
|
|
13
src/fccfg.c
13
src/fccfg.c
|
@ -283,7 +283,7 @@ FcConfigBuildFonts (FcConfig *config)
|
||||||
{
|
{
|
||||||
list = FcConfigGetFontDirs (config);
|
list = FcConfigGetFontDirs (config);
|
||||||
if (!list)
|
if (!list)
|
||||||
goto bail2;
|
goto bail3;
|
||||||
|
|
||||||
while ((dir = FcStrListNext (list)))
|
while ((dir = FcStrListNext (list)))
|
||||||
{
|
{
|
||||||
|
@ -334,9 +334,10 @@ FcConfigBuildFonts (FcConfig *config)
|
||||||
FcConfigSetFonts (config, fonts, FcSetSystem);
|
FcConfigSetFonts (config, fonts, FcSetSystem);
|
||||||
|
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
bail3:
|
||||||
|
FcStrSetDestroy (oldDirs);
|
||||||
bail2:
|
bail2:
|
||||||
FcGlobalCacheDestroy (cache);
|
FcGlobalCacheDestroy (cache);
|
||||||
FcStrSetDestroy (oldDirs);
|
|
||||||
bail1:
|
bail1:
|
||||||
FcFontSetDestroy (fonts);
|
FcFontSetDestroy (fonts);
|
||||||
bail0:
|
bail0:
|
||||||
|
@ -605,17 +606,21 @@ FcBool
|
||||||
FcConfigAddBlank (FcConfig *config,
|
FcConfigAddBlank (FcConfig *config,
|
||||||
FcChar32 blank)
|
FcChar32 blank)
|
||||||
{
|
{
|
||||||
FcBlanks *b;
|
FcBlanks *b, *freeme = 0;
|
||||||
|
|
||||||
b = config->blanks;
|
b = config->blanks;
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
b = FcBlanksCreate ();
|
freeme = b = FcBlanksCreate ();
|
||||||
if (!b)
|
if (!b)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
if (!FcBlanksAdd (b, blank))
|
if (!FcBlanksAdd (b, blank))
|
||||||
|
{
|
||||||
|
if (freeme)
|
||||||
|
FcBlanksDestroy (freeme);
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
}
|
||||||
config->blanks = b;
|
config->blanks = b;
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,10 @@ FcCharSetPutLeaf (FcCharSet *fcs,
|
||||||
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcCharLeaf *));
|
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcCharLeaf *));
|
||||||
numbers = malloc ((fcs->num + 1) * sizeof (FcChar16));
|
numbers = malloc ((fcs->num + 1) * sizeof (FcChar16));
|
||||||
if (!numbers)
|
if (!numbers)
|
||||||
|
{
|
||||||
|
free (leaves);
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
}
|
||||||
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcChar16));
|
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcChar16));
|
||||||
|
|
||||||
for (i = 0; i < fcs->num; i++)
|
for (i = 0; i < fcs->num; i++)
|
||||||
|
@ -625,7 +628,7 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
|
||||||
int i = 256/32;
|
int i = 256/32;
|
||||||
if (ai.ucs4 == bi.ucs4)
|
if (ai.ucs4 == bi.ucs4)
|
||||||
{
|
{
|
||||||
FcChar32 *bm = bi.leaf->map;;
|
FcChar32 *bm = bi.leaf->map;
|
||||||
while (i--)
|
while (i--)
|
||||||
count += FcCharSetPopCount (*am++ & ~*bm++);
|
count += FcCharSetPopCount (*am++ & ~*bm++);
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,6 +578,7 @@ FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls)
|
||||||
}
|
}
|
||||||
first = FcFalse;
|
first = FcFalse;
|
||||||
}
|
}
|
||||||
|
FcStrListDone (list);
|
||||||
}
|
}
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1541,7 +1541,7 @@ FcPopBinary (FcConfigParse *parse, FcOp op)
|
||||||
FcConfigMessage (parse, FcSevereError, "out of memory");
|
FcConfigMessage (parse, FcSevereError, "out of memory");
|
||||||
FcExprDestroy (left);
|
FcExprDestroy (left);
|
||||||
FcExprDestroy (expr);
|
FcExprDestroy (expr);
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
expr = new;
|
expr = new;
|
||||||
}
|
}
|
||||||
|
@ -1950,6 +1950,7 @@ FcParsePatelt (FcConfigParse *parse)
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
FcConfigMessage (parse, FcSevereWarning, "missing pattern element name");
|
FcConfigMessage (parse, FcSevereWarning, "missing pattern element name");
|
||||||
|
FcPatternDestroy (pattern);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1988,6 +1989,7 @@ FcParsePattern (FcConfigParse *parse)
|
||||||
if (!FcPatternAppend (pattern, vstack->u.pattern))
|
if (!FcPatternAppend (pattern, vstack->u.pattern))
|
||||||
{
|
{
|
||||||
FcConfigMessage (parse, FcSevereError, "out of memory");
|
FcConfigMessage (parse, FcSevereError, "out of memory");
|
||||||
|
FcPatternDestroy (pattern);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue