1 Star 0 Fork 44

Linux_zhang/less

forked from src-openEuler/less 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-minor-memory-leak-with-input-preprocessor.-150.patch 743 Bytes
一键复制 编辑 原始数据 按行查看 历史
From da495f5340e5756c0e1dab1e53c2235c3e54660d Mon Sep 17 00:00:00 2001
From: keinflue <80230456+keinflue@users.noreply.github.com>
Date: Fri, 16 Apr 2021 21:12:11 +0000
Subject: [PATCH] Fix minor memory leak with input preprocessor. (#150)
If the read doesn't succeed, readfd still returns a malloc'ed buffer.
---
filename.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/filename.c b/filename.c
index 9cfa4de..3132baa 100644
--- a/filename.c
+++ b/filename.c
@@ -946,10 +946,13 @@ open_altfile(filename, pf, pfd)
cmd = readfd(fd);
pclose(fd);
if (*cmd == '\0')
+ {
/*
* Pipe is empty. This means there is no alt file.
*/
+ free(cmd);
return (NULL);
+ }
return (cmd);
#endif /* HAVE_POPEN */
}
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Linux_zhang2024/less.git
git@gitee.com:Linux_zhang2024/less.git
Linux_zhang2024
less
less
master

搜索帮助