free work items after processing them
Modified: trunk/reactos/drivers/dd/serial/rw.c
Modified: trunk/reactos/drivers/dd/serial/serial.h

Modified: trunk/reactos/drivers/dd/serial/rw.c
--- trunk/reactos/drivers/dd/serial/rw.c	2005-04-05 12:34:38 UTC (rev 14501)
+++ trunk/reactos/drivers/dd/serial/rw.c	2005-04-05 15:08:18 UTC (rev 14502)
@@ -125,8 +125,11 @@
 	Irp = WorkItemData->Irp;
 	
 	ReadBytes(DeviceObject, Irp, WorkItemData);
+	
+	IoCompleteRequest(Irp, IO_NO_INCREMENT);
+	
+	IoFreeWorkItem(WorkItemData->IoWorkItem);
 	ExFreePoolWithTag(pWorkItemData, SERIAL_TAG);
-	IoCompleteRequest(Irp, IO_NO_INCREMENT);
 }
 
 NTSTATUS STDCALL
@@ -215,7 +218,8 @@
 	WorkItem = IoAllocateWorkItem(DeviceObject);
 	if (WorkItem)
 	{
-		IoQueueWorkItem(WorkItem, SerialReadWorkItem, DelayedWorkQueue, WorkItemData);
+                WorkItemData->IoWorkItem = WorkItem;
+                IoQueueWorkItem(WorkItem, SerialReadWorkItem, DelayedWorkQueue, WorkItemData);
 		IoMarkIrpPending(Irp);
 		return STATUS_PENDING;
 	}

Modified: trunk/reactos/drivers/dd/serial/serial.h
--- trunk/reactos/drivers/dd/serial/serial.h	2005-04-05 12:34:38 UTC (rev 14501)
+++ trunk/reactos/drivers/dd/serial/serial.h	2005-04-05 15:08:18 UTC (rev 14502)
@@ -108,6 +108,7 @@
 typedef struct _WORKITEM_DATA
 {
 	PIRP Irp;
+	PIO_WORKITEM IoWorkItem;
 	
 	BOOLEAN UseIntervalTimeout;
 	BOOLEAN UseTotalTimeout;