virtio bus: Fix resource leak. CID 1032283
* bus is allocated but not deleted and not used after an error
This commit is contained in:
parent
b027a0a2f7
commit
27938cb64f
@ -252,7 +252,6 @@ init_bus(device_node* node, void** bus_cookie)
|
|||||||
|
|
||||||
pci_device_module_info* pci;
|
pci_device_module_info* pci;
|
||||||
pci_device* device;
|
pci_device* device;
|
||||||
|
|
||||||
{
|
{
|
||||||
device_node* parent = gDeviceManager->get_parent_node(node);
|
device_node* parent = gDeviceManager->get_parent_node(node);
|
||||||
device_node* pciParent = gDeviceManager->get_parent_node(parent);
|
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;
|
bus->irq = pciInfo.u.h0.interrupt_line;
|
||||||
if (bus->irq == 0 || bus->irq == 0xff) {
|
if (bus->irq == 0 || bus->irq == 0xff) {
|
||||||
ERROR("PCI IRQ not assigned\n");
|
ERROR("PCI IRQ not assigned\n");
|
||||||
|
delete bus;
|
||||||
return B_ERROR;
|
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_RESET);
|
||||||
set_status(bus, VIRTIO_CONFIG_STATUS_ACK);
|
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->pci, bus->device);
|
||||||
|
|
||||||
*bus_cookie = bus;
|
*bus_cookie = bus;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user