Author: cgutman
Date: Fri Apr 17 05:55:31 2009
New Revision: 40554
URL:
http://svn.reactos.org/svn/reactos?rev=40554&view=rev
Log:
- Don't leak the dma adapter when we fail
Modified:
trunk/reactos/drivers/network/ndis/ndis/io.c
Modified: trunk/reactos/drivers/network/ndis/ndis/io.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/io.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/io.c [iso-8859-1] Fri Apr 17 05:55:31 2009
@@ -327,6 +327,8 @@
NDIS_DbgPrint(MIN_TRACE, ("Didn't get enough map registers from hal -
requested 0x%x, got 0x%x\n",
MapRegistersPerBaseRegister, AvailableMapRegisters));
+ AdapterObject->DmaOperations->PutDmaAdapter(AdapterObject);
+ Adapter->NdisMiniportBlock.SystemAdapterObject = NULL;
return NDIS_STATUS_RESOURCES;
}
@@ -335,6 +337,8 @@
if(!Adapter->NdisMiniportBlock.MapRegisters)
{
NDIS_DbgPrint(MIN_TRACE, ("insufficient resources.\n"));
+ AdapterObject->DmaOperations->PutDmaAdapter(AdapterObject);
+ Adapter->NdisMiniportBlock.SystemAdapterObject = NULL;
return NDIS_STATUS_RESOURCES;
}
@@ -359,6 +363,9 @@
{
NDIS_DbgPrint(MIN_TRACE, ("IoAllocateAdapterChannel failed: 0x%x\n",
NtStatus));
ExFreePool(Adapter->NdisMiniportBlock.MapRegisters);
+ AdapterObject->DmaOperations->PutDmaAdapter(AdapterObject);
+ Adapter->NdisMiniportBlock.CurrentMapRegister =
Adapter->NdisMiniportBlock.BaseMapRegistersNeeded = 0;
+ Adapter->NdisMiniportBlock.SystemAdapterObject = NULL;
return NDIS_STATUS_RESOURCES;
}
@@ -370,6 +377,9 @@
{
NDIS_DbgPrint(MIN_TRACE, ("KeWaitForSingleObject failed: 0x%x\n",
NtStatus));
ExFreePool(Adapter->NdisMiniportBlock.MapRegisters);
+ AdapterObject->DmaOperations->PutDmaAdapter(AdapterObject);
+ Adapter->NdisMiniportBlock.CurrentMapRegister =
Adapter->NdisMiniportBlock.BaseMapRegistersNeeded = 0;
+ Adapter->NdisMiniportBlock.SystemAdapterObject = NULL;
return NDIS_STATUS_RESOURCES;
}