1 Star 0 Fork 120

Jiabo Feng/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-irq-Avoid-covering-object-refcount-of-qemu_ir.patch 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
Jiabo Feng 提交于 2024-04-07 10:21 . QEMU update to version 8.2.0-5
From 48a328ee1a5a71b7048e4591310471c759fc5af6 Mon Sep 17 00:00:00 2001
From: Keqian Zhu <zhukeqian1@huawei.com>
Date: Mon, 27 Jul 2020 20:39:07 +0800
Subject: [PATCH] bugfix: irq: Avoid covering object refcount of qemu_irq
Avoid covering object refcount of qemu_irq, otherwise it may causes
memory leak.
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
hw/core/irq.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/core/irq.c b/hw/core/irq.c
index 3f14e2dda7..df9b5dac9b 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -110,7 +110,10 @@ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
int i;
qemu_irq *old_irqs = qemu_allocate_irqs(NULL, NULL, n);
for (i = 0; i < n; i++) {
- *old_irqs[i] = *gpio_in[i];
+ old_irqs[i]->handler = gpio_in[i]->handler;
+ old_irqs[i]->opaque = gpio_in[i]->opaque;
+ old_irqs[i]->n = gpio_in[i]->n;
+
gpio_in[i]->handler = handler;
gpio_in[i]->opaque = &old_irqs[i];
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/JiaboFeng/qemu.git
git@gitee.com:JiaboFeng/qemu.git
JiaboFeng
qemu
qemu
master

搜索帮助