From: Serge van den Boom Date: Sun, 5 Apr 2009 23:00:18 +0000 (-0400) Subject: Correctly handle mmap() failure (#21062) X-Git-Tag: 2.7.0~17 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1dd95fcb8bb9b5feeabee0dfe334448733f5cb4c;p=fontconfig.git Correctly handle mmap() failure (#21062) --- diff --git a/src/fccache.c b/src/fccache.c index 63319f6..69e1a6b 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -553,6 +553,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat) { #if defined(HAVE_MMAP) || defined(__CYGWIN__) cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0); + if (cache == MAP_FAILED) + cache = NULL; #elif defined(_WIN32) { HANDLE hFileMap;