1 Star 0 Fork 71

tzr/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virNodeDevPCICapSRIOVVirtualParseXML-fix-memleak-of-.patch 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
From d707abe3210f4bdc723aefdf8e99710efc78edea Mon Sep 17 00:00:00 2001
From: Hao Wang <wanghao232@huawei.com>
Date: Thu, 30 Jul 2020 20:03:08 +0800
Subject: [PATCH 040/108] virNodeDevPCICapSRIOVVirtualParseXML: fix memleak of
addr
virPCIDeviceAddressPtr 'addr' is forgotten to be freed in the branch
'VIR_APPEND_ELEMENT() < 0'. Use g_autoptr instead.
Signed-off-by: Hao Wang <wanghao232@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit f7f5b86be25d27915cc67a8b84fa9a2589df4ab8)
---
src/conf/node_device_conf.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 4cf5b6e3d7..d64f6d3986 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1503,15 +1503,13 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt,
goto cleanup;
for (i = 0; i < naddresses; i++) {
- virPCIDeviceAddressPtr addr = NULL;
+ g_autoptr(virPCIDeviceAddress) addr = NULL;
if (VIR_ALLOC(addr) < 0)
goto cleanup;
- if (virPCIDeviceAddressParseXML(addresses[i], addr) < 0) {
- VIR_FREE(addr);
+ if (virPCIDeviceAddressParseXML(addresses[i], addr) < 0)
goto cleanup;
- }
if (VIR_APPEND_ELEMENT(pci_dev->virtual_functions,
pci_dev->num_virtual_functions,
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tom0392/libvirt.git
git@gitee.com:tom0392/libvirt.git
tom0392
libvirt
libvirt
master

搜索帮助