1 Star 0 Fork 71

yoo/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virNWFilterObjListFree-Prevent-null-pointer-derefern.patch 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
Jiangjiacheng 提交于 2023-01-04 12:02 . Backport patches from upstream
From 2153e7eb25d0ffd2b4af0776df8e089e7c503687 Mon Sep 17 00:00:00 2001
From: huangkai <huangkai101@huawei.com>
Date: Tue, 2 Aug 2022 16:26:13 +0800
Subject: [PATCH 16/22] virNWFilterObjListFree: Prevent null pointer derefernce
Allow virNWFilterObjListFree to be called with a NULL argument.
This enables a later patch to use virNWFilterObjListFree as a
cleanup function safely, as it is a no-op if virNWFilterObj was
not yet initialized.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/virnwfilterobj.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index c9e224061d..cc59c0ea9d 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -108,6 +108,11 @@ void
virNWFilterObjListFree(virNWFilterObjListPtr nwfilters)
{
size_t i;
+
+ if (!nwfilters) {
+ return;
+ }
+
for (i = 0; i < nwfilters->count; i++)
virNWFilterObjFree(nwfilters->objs[i]);
VIR_FREE(nwfilters->objs);
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mdLUbG/libvirt.git
git@gitee.com:mdLUbG/libvirt.git
mdLUbG
libvirt
libvirt
master

搜索帮助