+2006-01-24 Patrick Lam <plam@mit.edu>
+ * src/fccache.c (FcDirCacheUnlink, FcDirCacheWrite):
+ * src/fcfreetype.c (FcFreeTypeQuery):
+
+ Fix memory leaks reported by Ronny V. Vindenes.
+
2006-01-19 Andreas Schwab <schwab@suse.de>
reviewed by: plam
FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
{
char *cache_file;
- char *cache_hashed;
+ char *cache_hashed = 0;
int fd, collisions;
struct stat cache_stat;
char name_buf[FC_MAX_FILE_LEN];
fd = -1; collisions = 0;
do
{
+ if (cache_hashed)
+ FcStrFree ((FcChar8 *)cache_hashed);
+
cache_hashed = FcDirCacheHashName (cache_file, collisions++);
if (!cache_hashed)
goto bail;
FcCacheReadString (fd, name_buf, sizeof (name_buf));
if (!strlen(name_buf))
+ {
+ FcStrFree ((FcChar8 *)cache_hashed);
goto bail;
+ }
} while (strcmp (name_buf, cache_file) != 0);
FcStrFree ((FcChar8 *)cache_file);
if (ftruncate (fd, current_arch_start + truncate_to) == -1)
goto bail5;
+ free (header);
close(fd);
if (!FcAtomicReplaceOrig(atomic))
goto bail5;
FcChar8 *family = 0;
#endif
FcChar8 *complex;
+ FcChar8 *file2;
const FcChar8 *foundry = 0;
int spacing;
TT_OS2 *os2;
printf ("Saving unique fullname %s\n", full);
}
- if (!FcPatternAddString (pat, FC_FILE, (FcChar8 *)basename((char *)FcStrCopy(file))))
+ file2 = FcStrCopy (file);
+ if (!FcPatternAddString (pat, FC_FILE, (FcChar8 *)basename((char *)file2)))
+ {
+ FcStrFree (file2);
goto bail1;
+ }
+ FcStrFree (file2);
FcPatternAddFullFname (pat, (const char *)FcStrCopy (file));