1 Star 0 Fork 76

shangyibin/rpm

forked from src-openEuler/rpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-a-minor-memory-leak-on-suppressed-inhibition-loc.patch 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
Liquor 提交于 2021-01-11 11:10 . backport patches from upstream
From 4ddab4fb7e1ccc7dc466534250177b7d2682a9e2 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 29 Jan 2020 15:39:58 +0200
Subject: [PATCH] Fix a minor memory leak on suppressed inhibition lock warning
message
Commit 708e61307bc3fd027b016fdf5a1d1a5274c1843c introduced a memory leak
on the error object: if the message is suppressed then the error object
is never freed. Test for the suppression conditions separately to fix.
---
plugins/systemd_inhibit.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/plugins/systemd_inhibit.c b/plugins/systemd_inhibit.c
index 0ddca9cd8..ecff30533 100644
--- a/plugins/systemd_inhibit.c
+++ b/plugins/systemd_inhibit.c
@@ -52,12 +52,14 @@ static int inhibit(void)
dbus_message_unref(reply);
}
- if (dbus_error_is_set(&err)
- && !dbus_error_has_name(&err, DBUS_ERROR_NO_SERVER)
- && !dbus_error_has_name(&err, DBUS_ERROR_FILE_NOT_FOUND)) {
- rpmlog(RPMLOG_WARNING,
+ if (dbus_error_is_set(&err)) {
+ if (!dbus_error_has_name(&err, DBUS_ERROR_NO_SERVER) &&
+ !dbus_error_has_name(&err, DBUS_ERROR_FILE_NOT_FOUND))
+ {
+ rpmlog(RPMLOG_WARNING,
"Unable to get systemd shutdown inhibition lock: %s\n",
err.message);
+ }
dbus_error_free(&err);
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shangyibin/rpm.git
git@gitee.com:shangyibin/rpm.git
shangyibin
rpm
rpm
master

搜索帮助