[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/33] edu: fix memory leak on msi_broken platforms
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 28/33] edu: fix memory leak on msi_broken platforms |
Date: |
Thu, 1 Jun 2017 14:41:46 +0200 |
If msi_init fails, the thread has already been created and the
mutex/condvar are not destroyed. Initialize everything only
after the point where pci_edu_realize cannot fail.
Reported-by: Markus Armbruster <address@hidden>
Cc: Peter Xu <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/misc/edu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index 401039c..01acacf 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -343,6 +343,12 @@ static void pci_edu_realize(PCIDevice *pdev, Error **errp)
EduState *edu = DO_UPCAST(EduState, pdev, pdev);
uint8_t *pci_conf = pdev->config;
+ pci_config_set_interrupt_pin(pci_conf, 1);
+
+ if (msi_init(pdev, 0, 1, true, false, errp)) {
+ return;
+ }
+
timer_init_ms(&edu->dma_timer, QEMU_CLOCK_VIRTUAL, edu_dma_timer, edu);
qemu_mutex_init(&edu->thr_mutex);
@@ -350,12 +356,6 @@ static void pci_edu_realize(PCIDevice *pdev, Error **errp)
qemu_thread_create(&edu->thread, "edu", edu_fact_thread,
edu, QEMU_THREAD_JOINABLE);
- pci_config_set_interrupt_pin(pci_conf, 1);
-
- if (msi_init(pdev, 0, 1, true, false, errp)) {
- return;
- }
-
memory_region_init_io(&edu->mmio, OBJECT(edu), &edu_mmio_ops, edu,
"edu-mmio", 1 << 20);
pci_register_bar(pdev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &edu->mmio);
--
1.8.3.1
- [Qemu-devel] [PULL 23/33] exec: fix address_space_get_iotlb_entry page mask, (continued)
- [Qemu-devel] [PULL 23/33] exec: fix address_space_get_iotlb_entry page mask, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 24/33] nbd: Fully initialize client in case of failed negotiation, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 22/33] sockets: improve error reporting if UNIX socket path is too long, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 26/33] kvmclock: update system_time_msr address forcibly, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 25/33] qtest: add rtc periodic timer test, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 27/33] linuxboot_dma: compile for i486, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 28/33] edu: fix memory leak on msi_broken platforms,
Paolo Bonzini <=
- [Qemu-devel] [PULL 30/33] target/i386: Add GDB XML description for SSE registers, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 31/33] hw/core: nmi.c can be compiled as common-obj nowadays, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 29/33] i386/kvm: do not zero out segment flags if segment is unusable or not present, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 33/33] kvm: don't register smram_listener when smm is off, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 32/33] nbd: make it thread-safe, fix qcow2 over nbd, Paolo Bonzini, 2017/06/01
- Re: [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, no-reply, 2017/06/01
- Re: [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, no-reply, 2017/06/01