fontconfig: Branch 'main' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 15 08:58:44 UTC 2024


 fc-list/fc-list.c   |    7 ++++++-
 fc-query/fc-query.c |    2 ++
 fc-scan/fc-scan.c   |    2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6d0580b2427f50b45e1432ba0fb6128c19b6dbd4
Merge: 8bf3b04 71a6a99
Author: Akira TAGOH <akira at tagoh.org>
Date:   Tue Oct 15 08:58:39 2024 +0000

    Merge branch 'fix-memory-leaks' into 'main'
    
    Fix a memory leak in fc-list/fc-query/fc-scan
    
    See merge request fontconfig/fontconfig!334

commit 71a6a990aa8578ddd7140fe0b2c9f87508d2b59b
Author: Akira TAGOH <akira at tagoh.org>
Date:   Wed Oct 9 20:20:16 2024 +0900

    Fix a memory leak in fc-list/fc-query/fc-scan

diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
index 54796c8..5cacd51 100644
--- a/fc-list/fc-list.c
+++ b/fc-list/fc-list.c
@@ -113,6 +113,7 @@ main (int argc, char **argv)
     int			brief = 0;
     int			quiet = 0;
     const FcChar8	*format = NULL;
+    const FcChar8	*format_optarg = NULL;
     int			nfont = 0;
     int			i;
     FcObjectSet		*os = 0;
@@ -136,7 +137,7 @@ main (int argc, char **argv)
 	    brief = 1;
 	    break;
 	case 'f':
-	    format = (FcChar8 *) strdup (optarg);
+	    format_optarg = format = (FcChar8 *) strdup (optarg);
 	    break;
 	case 'q':
 	    quiet = 1;
@@ -218,6 +219,10 @@ main (int argc, char **argv)
 	nfont = fs->nfont;
 	FcFontSetDestroy (fs);
     }
+    if (format_optarg)
+    {
+	free ((void *)format_optarg);
+    }
 
     FcFini ();
 
diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c
index 74841b0..6e4774a 100644
--- a/fc-query/fc-query.c
+++ b/fc-query/fc-query.c
@@ -193,6 +193,8 @@ main (int argc, char **argv)
     }
 
     FcFontSetDestroy (fs);
+    if (format)
+	free (format);
 
     FcFini ();
     return err;
diff --git a/fc-scan/fc-scan.c b/fc-scan/fc-scan.c
index dca1cd5..df9638b 100644
--- a/fc-scan/fc-scan.c
+++ b/fc-scan/fc-scan.c
@@ -207,6 +207,8 @@ main (int argc, char **argv)
     }
 
     FcFontSetDestroy (fs);
+    if (format)
+	free (format);
 
     FcFini ();
     return i > 0 ? 0 : 1;


More information about the Fontconfig mailing list