From: Marc-André Lureau <marcandre.lur...@redhat.com> Use a PCIBus attribute to store the bsel value, instead of allocating and leaking it elsewhere.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- 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