diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-08-17 14:19:04 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-08-17 14:19:04 -0700 |
commit | c84ce6be6a7e2e70c9ab20b60bc7198699690d50 (patch) | |
tree | 2760cef2d4e4d92a6796c3740654be7d11708057 | |
parent | c1c5c9aa4cacb9138d6a2e5d37619f7960b54536 (diff) |
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.c | 6 |
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; |