From 27938cb64f0598ce14925a4258813742e1c45fa1 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 24 Jun 2013 15:18:23 -0500 Subject: [PATCH] virtio bus: Fix resource leak. CID 1032283 * bus is allocated but not deleted and not used after an error --- src/add-ons/kernel/busses/virtio/virtio_pci.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/busses/virtio/virtio_pci.cpp b/src/add-ons/kernel/busses/virtio/virtio_pci.cpp index 3c3a641475..8d2ff0acbd 100644 --- a/src/add-ons/kernel/busses/virtio/virtio_pci.cpp +++ b/src/add-ons/kernel/busses/virtio/virtio_pci.cpp @@ -252,7 +252,6 @@ init_bus(device_node* node, void** bus_cookie) pci_device_module_info* pci; pci_device* device; - { device_node* parent = gDeviceManager->get_parent_node(node); device_node* pciParent = gDeviceManager->get_parent_node(parent); @@ -276,6 +275,7 @@ init_bus(device_node* node, void** bus_cookie) bus->irq = pciInfo.u.h0.interrupt_line; if (bus->irq == 0 || bus->irq == 0xff) { ERROR("PCI IRQ not assigned\n"); + delete bus; return B_ERROR; } @@ -288,7 +288,7 @@ init_bus(device_node* node, void** bus_cookie) set_status(bus, VIRTIO_CONFIG_STATUS_RESET); set_status(bus, VIRTIO_CONFIG_STATUS_ACK); - TRACE("init_bus() %p node %p pci %p device %p\n", bus, node, + TRACE("init_bus() %p node %p pci %p device %p\n", bus, node, bus->pci, bus->device); *bus_cookie = bus;