1 Star 0 Fork 50

lxpzero/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
10019-basic-fileio-Fix-memory-leak-if-READ_FULL_FILE_SECU.patch 958 Bytes
一键复制 编辑 原始数据 按行查看 历史
From 14e0760c251fd5fc51731f7b58079c73f5055d64 Mon Sep 17 00:00:00 2001
From: Benjamin Robin <dev@benjarobin.fr>
Date: Sun, 14 Apr 2019 17:21:27 +0200
Subject: [PATCH] basic/fileio: Fix memory leak if READ_FULL_FILE_SECURE flag
is used
The memory leak introduced in #12223 (15f8f02)
(cherry picked from commit 315a51982af2d480de9f7539346f30425e37a01e)
Signed-off-by: Guorui Yu <GuoRui.Yu@linux.alibaba.com>
---
src/basic/fileio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 3abeb0d7f4..bb804e3afa 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -438,6 +438,7 @@ int read_full_stream_full(
}
memcpy_safe(t, buf, n);
explicit_bzero_safe(buf, n);
+ buf = mfree(buf);
} else {
t = realloc(buf, n_next + 1);
if (!t)
--
2.39.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lxpzero/systemd.git
git@gitee.com:lxpzero/systemd.git
lxpzero
systemd
systemd
a8

搜索帮助