13 Star 0 Fork 9

ocs-commit/fontconfig

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
71a6a990aa8578ddd7140fe0b2c9f87508d2b59b.patch 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
ocs-bot 提交于 2025-01-02 10:14 +08:00 . - [Type] bugfix
From 71a6a990aa8578ddd7140fe0b2c9f87508d2b59b Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Wed, 9 Oct 2024 20:20:16 +0900
Subject: [PATCH] Fix a memory leak in fc-list/fc-query/fc-scan
---
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(-)
diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
index 54796c85..5cacd51d 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 74841b0e..6e4774a1 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 dca1cd54..df9638bb 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;
--
GitLab
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ocs-commit/fontconfig.git
git@gitee.com:ocs-commit/fontconfig.git
ocs-commit
fontconfig
fontconfig
master

搜索帮助