1 Star 0 Fork 38

徐想想/bash

forked from src-openEuler/bash 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fix-small-memleak-in-globbing.patch 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
hongjinghao 提交于 2023-12-04 17:12 . sync patches from bash community
From 829aad36dbbeee462fa142fe2c571fd7ab735ba8 Mon Sep 17 00:00:00 2001
From: Chet Ramey <[email protected]>
Date: Mon, 26 Jun 2023 17:09:08 -0400
Subject: [PATCH] backport part of patch to fix small memleak in globbing
---
lib/glob/glob.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/glob/glob.c b/lib/glob/glob.c
index b66af85..e4283bd 100644
--- a/lib/glob/glob.c
+++ b/lib/glob/glob.c
@@ -1446,6 +1446,12 @@ glob_filename (pathname, flags)
free ((char *) array);
else if ((dflags & GX_ALLDIRS) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0')
free (temp_results); /* expanding ** case above */
+ else if (array == temp_results)
+ /* If array == temp_results, either we assigned it above or
+ glob_dir_to_array returned temp_results because the dirname
+ was the empty string. In any case, we assume temp_results
+ has not been freed, and free it here. */
+ free (temp_results);
if (shouldbreak)
break;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xu-think-about-it/bash.git
[email protected]:xu-think-about-it/bash.git
xu-think-about-it
bash
bash
master

搜索帮助