Fix assertion in FcCacheFini().
This commit is contained in:
parent
1bacf0fb44
commit
5258a48f40
72
fontconfig-fix-assertion.patch
Normal file
72
fontconfig-fix-assertion.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From fbc05949ef52c8a8d69233eed77f6636dffec280 Mon Sep 17 00:00:00 2001
|
||||
From: Akira TAGOH <akira@tagoh.org>
|
||||
Date: Wed, 26 Feb 2020 15:42:21 +0900
|
||||
Subject: [PATCH] Fix assertion in FcFini()
|
||||
|
||||
Due to the unproper initialization of `latest_mtime', the duplicate caches
|
||||
was still in fcCacheChains with no references. which means no one frees
|
||||
them. thus, the memory leak was happened.
|
||||
|
||||
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/227
|
||||
---
|
||||
src/fccache.c | 9 +++++----
|
||||
src/fcinit.c | 4 ++--
|
||||
2 files changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/fccache.c b/src/fccache.c
|
||||
index 4744a84..035458e 100644
|
||||
--- a/src/fccache.c
|
||||
+++ b/src/fccache.c
|
||||
@@ -365,7 +365,6 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
|
||||
struct stat file_stat, dir_stat;
|
||||
FcBool ret = FcFalse;
|
||||
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
|
||||
- struct timeval latest_mtime = (struct timeval){ 0 };
|
||||
|
||||
if (sysroot)
|
||||
d = FcStrBuildFilename (sysroot, dir, NULL);
|
||||
@@ -390,6 +389,8 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
|
||||
#ifndef _WIN32
|
||||
FcBool retried = FcFalse;
|
||||
#endif
|
||||
+ struct timeval latest_mtime = (struct timeval){ 0 };
|
||||
+
|
||||
if (sysroot)
|
||||
cache_hashed = FcStrBuildFilename (sysroot, cache_dir, cache_base, NULL);
|
||||
else
|
||||
@@ -1081,12 +1082,12 @@ FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
|
||||
|
||||
if (!file_stat)
|
||||
file_stat = &my_file_stat;
|
||||
- fd = FcDirCacheOpenFile (cache_file, file_stat);
|
||||
- if (fd < 0)
|
||||
- return NULL;
|
||||
config = FcConfigReference (NULL);
|
||||
if (!config)
|
||||
return NULL;
|
||||
+ fd = FcDirCacheOpenFile (cache_file, file_stat);
|
||||
+ if (fd < 0)
|
||||
+ return NULL;
|
||||
cache = FcDirCacheMapFd (config, fd, file_stat, NULL);
|
||||
FcConfigDestroy (config);
|
||||
close (fd);
|
||||
diff --git a/src/fcinit.c b/src/fcinit.c
|
||||
index 6f82ebd..0e1421e 100644
|
||||
--- a/src/fcinit.c
|
||||
+++ b/src/fcinit.c
|
||||
@@ -199,10 +199,10 @@ void
|
||||
FcFini (void)
|
||||
{
|
||||
FcConfigFini ();
|
||||
- FcCacheFini ();
|
||||
+ FcConfigPathFini ();
|
||||
FcDefaultFini ();
|
||||
FcObjectFini ();
|
||||
- FcConfigPathFini ();
|
||||
+ FcCacheFini ();
|
||||
}
|
||||
|
||||
/*
|
||||
--
|
||||
2.24.1
|
||||
|
@ -5,7 +5,7 @@
|
||||
Summary: Font configuration and customization library
|
||||
Name: fontconfig
|
||||
Version: 2.13.92
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
# src/ftglue.[ch] is in Public Domain
|
||||
# src/fccache.c contains Public Domain code
|
||||
# fc-case/CaseFolding.txt is in the UCD
|
||||
@ -27,6 +27,7 @@ Patch5: %{name}-sysroot.patch
|
||||
Patch6: %{name}-read-latest-cache.patch
|
||||
Patch7: %{name}-mt.patch
|
||||
Patch8: %{name}-fix-test.patch
|
||||
Patch9: %{name}-fix-assertion.patch
|
||||
|
||||
BuildRequires: expat-devel
|
||||
BuildRequires: freetype-devel >= %{freetype_version}
|
||||
@ -168,6 +169,9 @@ HOME=/root /usr/bin/fc-cache -s
|
||||
%doc fontconfig-devel.txt fontconfig-devel
|
||||
|
||||
%changelog
|
||||
* Wed Feb 26 2020 Akira TAGOH <tagoh@redhat.com> - 2.13.92-7
|
||||
- Fix assertion in FcCacheFini().
|
||||
|
||||
* Thu Jan 30 2020 Akira TAGOH <tagoh@redhat.com> - 2.13.92-6
|
||||
- Fix some wrong behavior with sysroot option.
|
||||
- Fix reading the outdated caches.
|
||||
|
Loading…
Reference in New Issue
Block a user