加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fix_nss_database_check_reload_and_get_memleak.patch 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
张浩 提交于 2023-08-07 19:56 . nscd: sync some patches
From 66c23fa97a1bf8819051f1c358ae5eb38eeefae2 Mon Sep 17 00:00:00 2001
From: huangyu <huangyu106@huawei.com>
Date: Tue, 6 Sep 2022 11:55:40 +0800
Subject: [PATCH] huawei-fix_nss_database_check_reload_and_get_memleak.patch
The return nss_database_check_reload_adn_get (local, actions, db) does not check
whether the local value is empty before invoking the local interface.
Signed-off-by: huangyu <huangyu106@huawei.com>
---
nss/nss_database.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/nss/nss_database.c b/nss/nss_database.c
index 54561f03..a503890a 100644
--- a/nss/nss_database.c
+++ b/nss/nss_database.c
@@ -254,6 +254,8 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
__nss_database_get (db, &result);
local = nss_database_state_get ();
+ if (local == NULL)
+ return -1;
result = __nss_action_parse (service_line);
if (result == NULL)
@@ -399,6 +401,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
/* Acquire MO is needed because the thread that sets reload_disabled
may have loaded the configuration first, so synchronize with the
Release MO store there. */
+ if (local == NULL)
+ return false;
+
if (atomic_load_acquire (&local->data.reload_disabled))
{
*result = local->data.services[database_index];
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化