1 Star 0 Fork 24

futa/ghostscript

forked from src-openEuler/ghostscript 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Bug-697545-Prevent-memory-leak-in-gx-path-assign-free.patch 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
wangchen 提交于 2020-09-03 15:54 . Sync some patches from community
From efd0b47fe66a99097e200d76be1a4846ae2ef692 Mon Sep 17 00:00:00 2001
From: Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
Date: Wed, 6 May 2020 18:01:07 +0100
Subject: [PATCH] Bug 697545 : Prevent memory leak in gx_path_assign_free.
Prevent memory leak by freeing path on all errors.
Error created using :-
MEMENTO_FAILAT=16246 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.2120
---
base/gxpath.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/base/gxpath.c b/base/gxpath.c
index 4593d67..ffdea76 100644
--- a/base/gxpath.c
+++ b/base/gxpath.c
@@ -323,6 +323,7 @@ gx_path_assign_preserve(gx_path * ppto, gx_path * ppfrom)
int
gx_path_assign_free(gx_path * ppto, gx_path * ppfrom)
{
+ int code = 0;
/*
* Detect the special case where both paths have non-shared local
* segments, since we can avoid allocating new segments in this case.
@@ -349,13 +350,10 @@ gx_path_assign_free(gx_path * ppto, gx_path * ppfrom)
#undef tosegs
} else {
/* In all other cases, just do assign + free. */
- int code = gx_path_assign_preserve(ppto, ppfrom);
-
- if (code < 0)
- return code;
+ code = gx_path_assign_preserve(ppto, ppfrom);
}
gx_path_free(ppfrom, "gx_path_assign_free");
- return 0;
+ return code;
}
/*
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/funited/ghostscript.git
git@gitee.com:funited/ghostscript.git
funited
ghostscript
ghostscript
master

搜索帮助