1 Star 0 Fork 98

Mingtai/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
From b5162039b2309b78a9c1feb6cc1355988e02b6c3 Mon Sep 17 00:00:00 2001
From: xujing <17826839720@163.com>
Date: Wed, 8 Sep 2021 14:26:20 +0800
Subject: [PATCH] core: fix free undefined pointer when strdup failed in the
first loop
(cherry picked from commit 1509274359979079e3e61899ce12fc8b0f0958d9)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/b5162039b2309b78a9c1feb6cc1355988e02b6c3
---
src/core/load-fragment.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 8fb3c378ee..399a759ad0 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -800,7 +800,7 @@ int config_parse_exec(
if (!separate_argv0) {
char *w = NULL;
- if (!GREEDY_REALLOC(n, nlen + 2))
+ if (!GREEDY_REALLOC0(n, nlen + 2))
return log_oom();
w = strdup(path);
@@ -832,7 +832,7 @@ int config_parse_exec(
p += 2;
p += strspn(p, WHITESPACE);
- if (!GREEDY_REALLOC(n, nlen + 2))
+ if (!GREEDY_REALLOC0(n, nlen + 2))
return log_oom();
w = strdup(";");
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangmingtaip/systemd.git
git@gitee.com:yangmingtaip/systemd.git
yangmingtaip
systemd
systemd
master

搜索帮助