fontconfig: Branch 'main'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 src/fccache.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 57032f489b2cbe98c8e7927f4c18738869831f41
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Wed Aug 25 15:52:53 2021 +0900

    Fix a memory leak when trying to open a non-existing file
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1914716

diff --git a/src/fccache.c b/src/fccache.c
index ae3b9e3..d8ffe09 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -1111,7 +1111,7 @@ FcCache *
 FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
 {
     int	fd;
-    FcCache *cache;
+    FcCache *cache = NULL;
     struct stat	my_file_stat;
     FcConfig *config;
 
@@ -1121,11 +1121,13 @@ FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
     if (!config)
 	return NULL;
     fd = FcDirCacheOpenFile (cache_file, file_stat);
-    if (fd < 0)
-	return NULL;
-    cache = FcDirCacheMapFd (config, fd, file_stat, NULL);
+    if (fd >= 0)
+    {
+	cache = FcDirCacheMapFd (config, fd, file_stat, NULL);
+	close (fd);
+    }
     FcConfigDestroy (config);
-    close (fd);
+
     return cache;
 }
 



[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux