summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2019-08-17 14:19:04 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2019-08-17 14:19:04 -0700
commitc84ce6be6a7e2e70c9ab20b60bc7198699690d50 (patch)
tree2760cef2d4e4d92a6796c3740654be7d11708057
parentc1c5c9aa4cacb9138d6a2e5d37619f7960b54536 (diff)
downloadxorg-lib-libXfont-c84ce6be6a7e2e70c9ab20b60bc7198699690d50.tar.gz
CatalogueRescan: if opendir() fails, unref fpes, but don't free the cat
None of the callers of CatalogueRescan check for failure before accessing the cat pointer so don't free it (especially without clearing the pointer to it in fpe->private), just unref the contents. Can only be triggered if somehow stat() succeeds on the directory, but opendir fails anyway (removed between the calls? permission problem?). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/fontfile/catalogue.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c
index 5df01c2..b5c0331 100644
--- a/src/fontfile/catalogue.c
+++ b/src/fontfile/catalogue.c
@@ -151,14 +151,12 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
if ((forceScan == FALSE) && (statbuf.st_mtime <= cat->mtime))
return Successful;
+ CatalogueUnrefFPEs (fpe);
+
dir = opendir(path);
if (dir == NULL)
- {
- free(cat);
return BadFontPath;
- }
- CatalogueUnrefFPEs (fpe);
while (entry = readdir(dir), entry != NULL)
{
char *name;