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
+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>
* src/fccharset.c (FcCharSetPutLeaf):
{
list = FcConfigGetFontDirs (config);
if (!list)
- goto bail2;
+ goto bail3;
while ((dir = FcStrListNext (list)))
{
FcConfigSetFonts (config, fonts, FcSetSystem);
return FcTrue;
+bail3:
+ FcStrSetDestroy (oldDirs);
bail2:
FcGlobalCacheDestroy (cache);
- FcStrSetDestroy (oldDirs);
bail1:
FcFontSetDestroy (fonts);
bail0:
FcConfigAddBlank (FcConfig *config,
FcChar32 blank)
{
- FcBlanks *b;
+ FcBlanks *b, *freeme = 0;
b = config->blanks;
if (!b)
{
- b = FcBlanksCreate ();
+ freeme = b = FcBlanksCreate ();
if (!b)
return FcFalse;
}
if (!FcBlanksAdd (b, blank))
+ {
+ if (freeme)
+ FcBlanksDestroy (freeme);
return FcFalse;
+ }
config->blanks = b;
return FcTrue;
}
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcCharLeaf *));
numbers = malloc ((fcs->num + 1) * sizeof (FcChar16));
if (!numbers)
+ {
+ free (leaves);
return FcFalse;
+ }
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcChar16));
for (i = 0; i < fcs->num; i++)
int i = 256/32;
if (ai.ucs4 == bi.ucs4)
{
- FcChar32 *bm = bi.leaf->map;;
+ FcChar32 *bm = bi.leaf->map;
while (i--)
count += FcCharSetPopCount (*am++ & ~*bm++);
}
}
first = FcFalse;
}
+ FcStrListDone (list);
}
return FcTrue;
}
FcConfigMessage (parse, FcSevereError, "out of memory");
FcExprDestroy (left);
FcExprDestroy (expr);
- break;
+ return 0;
}
expr = new;
}
if (!name)
{
FcConfigMessage (parse, FcSevereWarning, "missing pattern element name");
+ FcPatternDestroy (pattern);
return;
}
if (!FcPatternAppend (pattern, vstack->u.pattern))
{
FcConfigMessage (parse, FcSevereError, "out of memory");
+ FcPatternDestroy (pattern);
return;
}
break;