Fix memory leak in error case (Coverity defects #1820, #1821, #1822).
Fix memory leak (Coverity defect #1819).
prevent crash when invalid include line is parsed (Coverity defect #763).
Fix potential null pointer access (Coverity defect #1804).
Remove dead code (Coverity defect #1194).
Prevent potential null pointer access (Coverity defect #767), ensure error
value is read (Coverity defect #1195).
reviewed by: plam
+2006-04-11 Patrick Lam <plam@mit.edu>
+ * src/fccharset.c (FcCharSetPutLeaf):
+
+ Properly convert static charsets to dynamic charsets.
+
+2006-04-11 Frederic Crozat <fcrozat@mandriva.com>
+ reviewed by: plam
+
+ * src/fcpat.c: (FcValueListEntCreate, FcPatternBaseFreeze,
+ FcPatternFreeze):
+ Fix memory leak in error case (Coverity defects #1820, #1821, #1822).
+
+ * src/fclang.c: (FcNameUnparseLangSet):
+ Fix memory leak (Coverity defect #1819).
+
+ * fc-lang/fc-lang.c: (scan):
+ prevent crash when invalid include line is parsed (Coverity defect
+ #763).
+
+ * fc-cat/fc-cat.c: (FcCacheFileRead):
+ Fix potential null pointer access (Coverity defect #1804).
+
+ * src/fcname.c: (FcObjectUnserialize):
+ Remove dead code (Coverity defect #1194).
+
+ * src/fcfreetype.c: (GetScriptTags):
+ Prevent potential null pointer access (Coverity defect #767),
+ ensure error value is read (Coverity defect #1195).
+
2006-04-11 Behdad Esfahbod <behdad@cs.toronto.edu>
reviewed by: plam
char subdirName[FC_MAX_FILE_LEN + 1 + 12 + 1];
static char name_buf[8192], *dir;
FcChar8 * ls;
+ char * buf;
if (!cache_file)
goto bail;
if (current_arch_start < 0)
goto bail1;
- while (strlen(FcCacheReadString (fd, subdirName, sizeof (subdirName))) > 0)
+ while ((buf = FcCacheReadString (fd, subdirName, sizeof (subdirName)))
+ && *buf)
FcStrSetAdd (dirs, (FcChar8 *)subdirName);
dir = strdup(name_buf);
if (!strncmp (line, "include", 7))
{
file = strchr (line, ' ');
+ if (!file)
+ fatal (line, lineno,
+ "invalid syntax, expected: include filename");
while (isspace(*file))
file++;
f = scanopen (file);
return FcFalse;
if (fcs->bank != FC_BANK_DYNAMIC)
{
+ /* convert to dynamic */
int i;
leaves = malloc ((fcs->num + 1) * sizeof (FcCharLeaf *));
leaves[i] = FcCharSetGetLeaf(fcs, i);
memcpy (numbers, FcCharSetGetNumbers(fcs),
fcs->num * sizeof (FcChar16));
+
+ fcs->bank = FC_BANK_DYNAMIC;
+ fcs->u.dyn.leaves = leaves;
+ fcs->u.dyn.numbers = numbers;
}
else
{
FT_Stream stream = face->stream;
FT_Error error;
FT_UShort n, p;
- FT_Memory memory = stream->memory;
+ FT_Memory memory;
if ( !stream )
return TT_Err_Invalid_Face_Handle;
+ memory = stream->memory;
+
if (( error = ftglue_face_goto_table( face, tabletag, stream ) ))
return error;
cur_offset = ftglue_stream_pos( stream );
- if ( ftglue_stream_seek( stream, new_offset ) )
+ if (( error = ftglue_stream_seek( stream, new_offset ) ))
goto Fail;
if ( error == TT_Err_Ok )
{
if (!first)
if (!FcStrBufChar (buf, '|'))
+ {
+ FcStrListDone (list);
return FcFalse;
+ }
if (!FcStrBufString (buf, extra))
- return FcFalse;
+ {
+ FcStrListDone (list);
+ return FcFalse;
+ }
first = FcFalse;
}
}
int i;
char * bp = (char *)block_ptr;
FcObjectType * bn;
- FcObjectTypeList * bnl;
bn = malloc (sizeof (const FcObjectType) * (new_biggest + 1));
if (!bn)
return 0;
- bnl = malloc (sizeof (FcObjectTypeList));
- if (!bnl)
- {
- free (bn);
- return 0;
- }
-
for (i = 0; i < new_biggest; i++)
{
const FcObjectType * t = FcNameGetObjectType(bp);
return 0;
new = malloc (n * sizeof (FcValueList));
if (!new)
+ {
+ free (ea);
return 0;
+ }
memset(new, 0, n * sizeof (FcValueList));
FcMemAlloc (FC_MEM_VALLIST, size);
e = &ea->ent;
ep = FcPatternCreate();
if (!ep)
- return 0;
+ goto bail;
ent->pattern = ep;
epp = malloc(b->num * sizeof (FcPatternElt));
if (!epp)
+ {
+ FcPatternDestroy (ep);
goto bail;
+ }
ep->elts = FcPatternEltPtrCreateDynamic(epp);
FcMemAlloc (FC_MEM_PATELT, sizeof (FcPatternElt)*(b->num));
e = malloc(b->num * sizeof (FcPatternElt));
if (!e)
+ {
+ FcPatternDestroy (b);
return 0;
+ }
b->elts = FcPatternEltPtrCreateDynamic(e);
FcMemAlloc (FC_MEM_PATELT, sizeof (FcPatternElt)*(b->num));