summaryrefslogtreecommitdiff
path: root/fc-cat
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2006-04-11 14:20:59 +0000
committerPatrick Lam <plam@MIT.EDU>2006-04-11 14:20:59 +0000
commit04f7d3e7fd5069965bc74e678fc51b0412d15aa9 (patch)
tree9e5c852042dc571817a7226f31e658cba2411d06 /fc-cat
parentaf2ad236f037c7a53e73b9454f620de1a52f0422 (diff)
Properly convert static charsets to dynamic charsets.
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
Diffstat (limited to 'fc-cat')
-rw-r--r--fc-cat/fc-cat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c
index 80c381c0..09b20f66 100644
--- a/fc-cat/fc-cat.c
+++ b/fc-cat/fc-cat.c
@@ -244,6 +244,7 @@ FcCacheFileRead (FcFontSet * set, FcStrSet *dirs, char *cache_file)
char subdirName[FC_MAX_FILE_LEN + 1 + 12 + 1];
static char name_buf[8192], *dir;
FcChar8 * ls;
+ char * buf;
if (!cache_file)
goto bail;
@@ -265,7 +266,8 @@ FcCacheFileRead (FcFontSet * set, FcStrSet *dirs, char *cache_file)
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);