acpi-build: fix memory leak with bridge hp off
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 28 Jan 2015 16:18:50 +0000 (18:18 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 26 Feb 2015 11:42:15 +0000 (12:42 +0100)
When bridge hotplug is disabled for old machine types,
we never free memory allocated for temporary tables.
Fix this up.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/acpi-build.c

index 4944249b845e5f991ea11acdf632320baa695b86..74586f346fe17fc63217ba04059e3484590c1ba1 100644 (file)
@@ -859,6 +859,9 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
      * to make acpi tables compatible with legacy machine types.
      */
     if (!child->pcihp_bridge_en && bus->parent_dev) {
+        build_free_array(bus_table);
+        build_pci_bus_state_cleanup(child);
+        g_free(child);
         return;
     }