[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/37] pci-bus: do not allocate and leak bsel
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH 23/37] pci-bus: do not allocate and leak bsel |
Date: |
Tue, 19 Jul 2016 12:54:18 +0400 |
From: Marc-André Lureau <address@hidden>
Use a PCIBus attribute to store the bsel value, instead of allocating
and leaking it elsewhere.
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/i386/acpi-build.c | 7 ++-----
include/hw/pci/pci_bus.h | 1 +
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f4ba3a4..c1e7d93 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -428,14 +428,11 @@ build_madt(GArray *table_data, BIOSLinker *linker,
PCMachineState *pcms)
static void *acpi_set_bsel(PCIBus *bus, void *opaque)
{
unsigned *bsel_alloc = opaque;
- unsigned *bus_bsel;
if (qbus_is_hotpluggable(BUS(bus))) {
- bus_bsel = g_malloc(sizeof *bus_bsel);
-
- *bus_bsel = (*bsel_alloc)++;
+ bus->bus_bsel = (*bsel_alloc)++;
object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
- bus_bsel, NULL);
+ &bus->bus_bsel, NULL);
}
return bsel_alloc;
diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
index 5484a9b..686cc7c 100644
--- a/include/hw/pci/pci_bus.h
+++ b/include/hw/pci/pci_bus.h
@@ -41,6 +41,7 @@ struct PCIBus {
int *irq_count;
Notifier machine_done;
+ unsigned bus_bsel;
};
typedef struct PCIBridgeWindows PCIBridgeWindows;
--
2.9.0
- Re: [Qemu-devel] [PATCH 18/37] acpi-build: fix array leak, (continued)
[Qemu-devel] [PATCH 19/37] char: disconnect peer when qemu_chr_free(), marcandre . lureau, 2016/07/19
[Qemu-devel] [PATCH 20/37] char: free MuxDriver when closing, marcandre . lureau, 2016/07/19
[Qemu-devel] [PATCH 21/37] tests: fix qom-test leaks, marcandre . lureau, 2016/07/19
[Qemu-devel] [PATCH 22/37] pc: free i8259, marcandre . lureau, 2016/07/19
[Qemu-devel] [PATCH 23/37] pci-bus: do not allocate and leak bsel,
marcandre . lureau <=
[Qemu-devel] [PATCH 24/37] pc: keep gsi reference, marcandre . lureau, 2016/07/19
[Qemu-devel] [PATCH 25/37] ahci: free irqs array, marcandre . lureau, 2016/07/19
[Qemu-devel] [PATCH 26/37] sd: free timer, marcandre . lureau, 2016/07/19