Author: cgutman
Date: Sun Sep 14 00:16:32 2008
New Revision: 36211
URL:
http://svn.reactos.org/svn/reactos?rev=36211&view=rev
Log:
- Change our method of queuing work items so we don't leak anymore
Modified:
branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Sun Sep
14 00:16:32 2008
@@ -748,11 +748,10 @@
KeLowerIrql(OldIrql);
}
-VOID NTAPI MiniportWorker(
- IN PDEVICE_OBJECT DeviceObject,
- IN PVOID Context)
-{
- PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(Context);
+VOID NTAPI MiniportWorker(IN PVOID WorkItem)
+{
+ PNDIS_WORK_ITEM NdisWorkItem = WorkItem;
+ PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(NdisWorkItem->Context);
KIRQL OldIrql;
NDIS_STATUS NdisStatus;
PVOID WorkItemContext;
@@ -858,6 +857,8 @@
break;
}
}
+
+ ExFreePool(WorkItem);
}
@@ -876,15 +877,20 @@
* SystemArgument2 = Unused
*/
{
- PIO_WORKITEM WorkItem;
- PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext);
+ PNDIS_WORK_ITEM NdisWorkItem;
+ PWORK_QUEUE_ITEM WorkItem;
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
- WorkItem = IoAllocateWorkItem(Adapter->NdisMiniportBlock.DeviceObject);
- if( !WorkItem ) return;
-
- IoQueueWorkItem(WorkItem, MiniportWorker, CriticalWorkQueue, DeferredContext);
+ NdisWorkItem = ExAllocatePool(NonPagedPool, sizeof(PNDIS_WORK_ITEM));
+
+ WorkItem = (PWORK_QUEUE_ITEM)NdisWorkItem->WrapperReserved;
+
+ NdisWorkItem->Context = DeferredContext;
+
+ ExInitializeWorkItem(WorkItem, MiniportWorker, NdisWorkItem);
+
+ ExQueueWorkItem(WorkItem, CriticalWorkQueue);
}