From: Keith Packard Date: Thu, 18 Oct 2007 16:41:00 +0000 (-0700) Subject: Must not insert cache into hash table before completely validating. X-Git-Tag: 2.4.91~23 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bc5e8adb4d05d1d03007951f46aaacc63c3b2197;p=fontconfig.git Must not insert cache into hash table before completely validating. The cache was inserted into the hash table before the timestamps in the cache were verified; if that verification failed, an extra pointer to the now freed cache would be left in the hash table. FcFini would fail an assertion as a result. --- diff --git a/src/fccache.c b/src/fccache.c index c43609c..bd8db46 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -493,8 +493,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat) if (cache->magic != FC_CACHE_MAGIC_MMAP || cache->version < FC_CACHE_CONTENT_VERSION || cache->size != fd_stat->st_size || - !FcCacheInsert (cache, fd_stat) || - !FcCacheTimeValid (cache, dir_stat)) + !FcCacheTimeValid (cache, dir_stat) || + !FcCacheInsert (cache, fd_stat)) { if (allocated) free (cache);