1 Star 0 Fork 108

panchenbo / qemu

forked from src-openEuler / qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
seabios-fix-memory-leak-when-pci-check.patch 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
jiangdongxu 提交于 2022-02-12 14:43 . backport seabios bugfix patches
From 73cb83af0649f958bb31b5b76f46c164c6f2952c Mon Sep 17 00:00:00 2001
From: jiangdongxu <jiangdongxu1@huawei.com>
Date: Fri, 11 Feb 2022 16:28:55 +0800
Subject: [PATCH 3/6] seabios: fix memory leak when pci check
fix code memory leak when pci check failed
free busses memory when pci_bios_check_devices function returns error in pci_setup()
Signed-off-by: liuxiangodng <liuxiangdong5@huawei.com>
Signed-off-by: jiangdongxu <jiangdongxu1@huawei.com>
---
roms/seabios/src/fw/pciinit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/roms/seabios/src/fw/pciinit.c b/roms/seabios/src/fw/pciinit.c
index d25931bb05..9df35d05d1 100644
--- a/roms/seabios/src/fw/pciinit.c
+++ b/roms/seabios/src/fw/pciinit.c
@@ -1171,8 +1171,11 @@ pci_setup(void)
return;
}
memset(busses, 0, sizeof(*busses) * (MaxPCIBus + 1));
- if (pci_bios_check_devices(busses))
+ if (pci_bios_check_devices(busses)) {
+ dprintf(1, "pci_bios_check_devices(busses) failed!\n");
+ free(busses);
return;
+ }
dprintf(1, "=== PCI new allocation pass #2 ===\n");
pci_bios_map_devices(busses);
--
2.27.0
1
https://gitee.com/panchenbo/qemu.git
git@gitee.com:panchenbo/qemu.git
panchenbo
qemu
qemu
master

搜索帮助