Check if pattern is not null before using it (Coverity defect #1883).
Fix memory leak with hash collision (Coverity defect #1829).
Fix memory leak when bail cases (Coverity defect #1828).
Don't leak directory name (Coverity defect #1827).
reviewed by: plam
+2006-04-10 Frederic Crozat <fcrozat@mandriva.com>
+ reviewed by: plam
+
+ * src/fccache.c: (FcDirCacheWrite):
+ Fix double free (spotted by Coverity, CID #1965).
+
+ * fc-match/fc-match.c: (main):
+ Check if pattern is not null before using it (Coverity defect #1883).
+
+ * src/fccache.c: (FcDirCacheWrite):
+ Fix memory leak with hash collision (Coverity defect #1829).
+
+ * src/fccfg.c: (FcConfigBuildFonts):
+ Fix memory leak when bail cases (Coverity defect #1828).
+
+ * src/fccache.c: (FcGlobalCacheLoad):
+ Don't leak directory name (Coverity defect #1827).
+
2006-04-07 Dominic Lachowicz <cinamod@hotmail.com>
reviewed by: plam
* fc-cache/Makefile.am:
else
pat = FcPatternCreate ();
+ if (!pat)
+ return 1;
+
FcConfigSubstitute (0, pat, FcMatchPattern);
FcDefaultSubstitute (pat);
if (match)
FcFontSetAdd (fs, match);
}
- if (pat)
- FcPatternDestroy (pat);
+ FcPatternDestroy (pat);
if (fs)
{
FcCache md;
off_t off;
- FcStrSetAdd (staleDirs, FcStrCopy ((FcChar8 *)name_buf));
+ FcStrSetAdd (staleDirs, (FcChar8 *)name_buf);
/* skip subdirs */
while (FcCacheReadString (cache->fd, subdirName,
if(!FcCacheReadString (fd, name_buf, sizeof (name_buf)) || !strlen(name_buf))
{
close (fd);
+ FcStrFree ((FcChar8 *)cache_hashed);
continue;
}
close (fd);
- if (strcmp (name_buf, cache_file) != 0)
+ if (strcmp (name_buf, cache_file) != 0)
+ {
+ FcStrFree ((FcChar8 *)cache_hashed);
continue;
+ }
break;
} while (1);
free (header);
close(fd);
if (!FcAtomicReplaceOrig(atomic))
- goto bail5;
+ goto bail3;
FcStrFree ((FcChar8 *)cache_hashed);
FcStrFree ((FcChar8 *)cache_file);
FcAtomicUnlock (atomic);
return FcTrue;
bail2:
+ FcGlobalCacheDestroy (cache);
FcStrSetDestroy (oldDirs);
bail1:
FcFontSetDestroy (fonts);