[Fontconfig] fontconfig: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 23 11:16:22 UTC 2019


 fc-cache/fc-cache.c |    2 ++
 src/fccache.c       |   17 +++++++++++++----
 src/fcxml.c         |    1 +
 3 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 1a0391c099e0fe03a4c877c5f5e05664737306a6
Author: Akira TAGOH <akira at tagoh.org>
Date:   Tue Jul 23 10:54:36 2019 +0000

    Fix memory leaks

diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 1866bd7..091eed4 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -187,6 +187,8 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 		ret++;
 		break;
 	    }
+	    FcStrFree (rooted_dir);
+	    rooted_dir = NULL;
 	    continue;
 	}
 
diff --git a/src/fcxml.c b/src/fcxml.c
index 1591c5a..2e26e77 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -1379,6 +1379,7 @@ _get_real_path_from_prefix(FcConfigParse *parse, const FcChar8 *path, const FcCh
     if (parent)
     {
 	retval = FcStrBuildFilename (parent, path, NULL);
+	FcStrFree (parent);
     }
     else
     {
commit 957625bafae3e4f86dba2543969f9e702fe76e93
Author: Akira TAGOH <akira at tagoh.org>
Date:   Tue Jul 23 10:53:16 2019 +0000

    Fix the fail on fc-cache
    
    Fallback code to UUID-based cache name was broken.
    
    Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/169

diff --git a/src/fccache.c b/src/fccache.c
index 7e42761..0976201 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -371,8 +371,6 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
         FcChar8	*cache_hashed;
 #ifndef _WIN32
 	FcBool retried = FcFalse;
-
-    retry:
 #endif
 	if (sysroot)
 	    cache_hashed = FcStrBuildFilename (sysroot, cache_dir, cache_base, NULL);
@@ -380,6 +378,9 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
 	    cache_hashed = FcStrBuildFilename (cache_dir, cache_base, NULL);
         if (!cache_hashed)
 	    break;
+#ifndef _WIN32
+      retry:
+#endif
         fd = FcDirCacheOpenFile (cache_hashed, &file_stat);
         if (fd >= 0) {
 	    ret = (*callback) (config, fd, &file_stat, &dir_stat, closure);
@@ -396,11 +397,19 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
 #ifndef _WIN32
 	else if (!retried)
 	{
+	    FcChar8	uuid_cache_base[CACHEBASE_LEN];
+
 	    retried = FcTrue;
-	    FcDirCacheBasenameUUID (config, dir, cache_base);
-	    if (cache_base[0] != 0)
+	    FcDirCacheBasenameUUID (config, dir, uuid_cache_base);
+	    if (uuid_cache_base[0] != 0)
 	    {
 		FcStrFree (cache_hashed);
+		if (sysroot)
+		    cache_hashed = FcStrBuildFilename (sysroot, cache_dir, uuid_cache_base, NULL);
+		else
+		    cache_hashed = FcStrBuildFilename (cache_dir, uuid_cache_base, NULL);
+		if (!cache_hashed)
+		    break;
 		goto retry;
 	    }
 	}


More information about the Fontconfig mailing list