Fix memory leaks reported by Ronny V. Vindenes.
This commit is contained in:
parent
986e35979e
commit
6f9fcb5186
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ FcBool
|
|||
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];
|
||||
|
@ -677,6 +677,9 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
|
|||
fd = -1; collisions = 0;
|
||||
do
|
||||
{
|
||||
if (cache_hashed)
|
||||
FcStrFree ((FcChar8 *)cache_hashed);
|
||||
|
||||
cache_hashed = FcDirCacheHashName (cache_file, collisions++);
|
||||
if (!cache_hashed)
|
||||
goto bail;
|
||||
|
@ -692,7 +695,10 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
|
|||
|
||||
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);
|
||||
|
@ -1189,6 +1195,7 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
|
|||
if (ftruncate (fd, current_arch_start + truncate_to) == -1)
|
||||
goto bail5;
|
||||
|
||||
free (header);
|
||||
close(fd);
|
||||
if (!FcAtomicReplaceOrig(atomic))
|
||||
goto bail5;
|
||||
|
|
|
@ -1000,6 +1000,7 @@ FcFreeTypeQuery (const FcChar8 *file,
|
|||
FcChar8 *family = 0;
|
||||
#endif
|
||||
FcChar8 *complex;
|
||||
FcChar8 *file2;
|
||||
const FcChar8 *foundry = 0;
|
||||
int spacing;
|
||||
TT_OS2 *os2;
|
||||
|
@ -1280,8 +1281,13 @@ FcFreeTypeQuery (const FcChar8 *file,
|
|||
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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue